jms | JMS Module : A portable extension
kandi X-RAY | jms Summary
kandi X-RAY | jms Summary
Provides injectable JMS resources and bridges the CDI event bus over JMS. For more information, see the Seam JMS Module page. Currently supported application servers: JBoss AS 6 Final. Two profiles exist to facilitate testing: jbossas-remote-6 jbossas-managed-6 - This profile is default when you just run mvn install. In order for tests dealing with consumers to pass HornetQ security must be disabled. See SEAMJMS-13 for more information. In $JBOSS_HOME/server/$PROFILE_NAME/deploy/hornetq/hornetq-configuration.xml you must add false below root node. To create the zip distribution, run mvn clean install -Pdistribution - the resulting zip is located in dist/target/seam-jms-${version}.zip.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Build the JMS Routes
- Adds the route
- Get the qualifiers from a set of annotations
- Creates a new session
- Cleans up the messages
- Cleans the connection
- Creates a session
- Cleans up all the messages
- Sets the connection factory
- Clean up the connection
- Registers the observer methods associated with the given interface
- Handle a JMS message listener
- Sends a text message
- Send a map
- Construct the route builder
- Handles a message
- Obtains the set of annotations declared by this route
- Initializes the openMQ server
- Shutdown the producer
- Observe JMS messages
- Process a message
- Set the route
- Handles message
- Send a map message
- Sends an object message
- Sends a string message
jms Key Features
jms Examples and Code Snippets
Community Discussions
Trending Discussions on jms
QUESTION
I am new in Spring Boot, I am trying to connect to SQL Server in Windows Authentication mode and here is my database configuration:
...ANSWER
Answered 2022-Apr-17 at 23:55I found the solution and it was only to use
integratedSecurity = false;
instead of
integratedSecurity = true;
so in this case connection string will be:
database.name= DatabaseName spring.datasource.url=jdbc:sqlserver://1.2.3.4:11111;DatabaseName=${database.name};integratedSecurity = false;.
Why to use integratedSecurity = false? The reason is here:
"Integrated Security When false, User ID and Password are specified in the connection. When true, the current Windows account credentials are used for authentication."
QUESTION
I'm currently struggling with exposing the REST api in my project using Apache Camel. When I run the project it seems to be fine in the console, but it just doesn't work:
curl: (7) Failed to connect to 127.0.0.1 port 8080: Connection refused
Here's the pom.xml file:
...ANSWER
Answered 2022-Mar-25 at 16:33The component camel-servlet
is not meant to be used in standalone mode as you are trying to do. It is meant to be used when you deploy your Camel application on a Servlet container or an Application Server.
In standalone mode, if you want to expose a rest endpoint, you should rather use a component like camel-undertow
, camel-jetty
, camel-netty-http
or camel-platform-http
(you can find the full list here).
Assuming that you want to use undertow
, you will have to follow the next steps
In your pom file you need to replace camel-rest
with camel-undertow
, as next:
QUESTION
I'm using JMSSerializerBundle in my entities definition, and RestBundle's annotations in controllers.
I have an entity with public and admin-protected attributes, let's say
...ANSWER
Answered 2022-Mar-20 at 11:43You should instantiate the fos-rest View
manually and add a Context
. On that Context
you can set the serialization groups at runtime by evaluating the users roles.
Something like this should work:
QUESTION
Using Spring Boot, how can I inject my JMS topic from a config property? I want to define the topic/queue name in application.properties
to be injected at runtime.
ANSWER
Answered 2022-Mar-11 at 18:46Try this:
@JmsListener(destination = "${my-topic}")
QUESTION
I have been upgrading one of the app to spring framwork 5.X from 3.X, one of the problem I am failing to resolve it error is following - this makes a use of spring-jms
cannot access org.springframework.context.SmartLifecycle [ERROR]
class file for org.springframework.context.SmartLifecycle not found
I can see last version the exact same code works with Spring 4.3.9 (last of 4.X release) and breaks with Spring 5.0.0 (First of 5.X releases)
I don't see my code exposing the class SmartLifecycle
but I have suspicion that DefaultMessageListenerContainer
instance is at a fault.
ANSWER
Answered 2022-Mar-10 at 17:41You need to add the following dependency to your pom.xml:
QUESTION
My ActiveMQ messaging instance (ActiveMQ 5.16.2 on Amazon MQ) uses STOMP. I cannot use the JMS QueueBrowser, and there is no way to "unack" a message. As soon as there is a consumer that pulled that message from the queue i.e. marked as "unconsumed" as stated in the docs here.
Assuming the broker cannot be changed, I was looking at the REST API mapping of JMS here, but I do not see any endpoint that mimic the ActiveMQ admin pages (JSP), that is capable to browse the queue, consumers and message content without actively "pulling" those messages from the queue.
So, how to implement that JMS logic we can see in the ActiveMQ admin pages programmatically (e.g. via REST apis)?
Looking at the docs of REST API, assumed having the logon, this approach works
...ANSWER
Answered 2022-Mar-07 at 17:15The REST/JMS mapping doesn't offer any message browsing functionality.
However, it's worth noting that the REST/JMS mapping is independent of the management functionality exposed by Jolokia. Jolokia is an HTTP-JMX bridge so anything exposed via JMX can be accessed via HTTP (e.g. using curl
). The DestinationViewMBean
has various "browse" methods you can use, e.g.:
QUESTION
I'm consuming messages from an ActiveMQ Artemis topic using JMS. My consumers are connecting directly to the FQQN of their consumer queues. Like this:
...ANSWER
Answered 2022-Mar-04 at 16:18It's not possible to configure the broker to auto-create a dead-letter queue whose name contains the name of the queue where the message was originally sent. As noted in the documentation, the dead-letter queue is named according to the address where the message was originally sent along with any configured prefix and/or suffix.
However, the message itself will have a property named _AMQ_ORIG_QUEUE
which will contain the name of the queue where the message was originally routed. This means you can use a consumer with a message selector (e.g. _AMQ_ORIG_QUEUE = 'ConsumerA'
) so that the consumer will only receive messages which were originally routed to a particular queue. This is functionally equivalent to having a dead-letter queue per-queue.
For what it's worth, what you're calling the "consumer name" isn't the name of the consumer at all, at least not from the broker's point of view. It's just the name of the queue.
Ultimately it's just not possible to configure a dead-letter queue per-queue. It's only possible to configure a dead-letter queue per address. This is true whether the resources are create manually (e.g. via broker.xml
) or automatically.
QUESTION
I have a requirement to establish a point to point communication with publisher and consumer in my application. What I'm given is a topic. So I should make sure the message in the topic will be consumed only once and only one instance should consume it. (There are multiple instances of the consumer.)
I understand message queue is the solution for the above requirement. But I will have to work with the topic given instead.
I tried one sample application and my all my consumer instances consumed the message in the topic. I planned to use a table to keep a track of message processing but it does not seem like a good solution. We use IBM MQ with spring boot JMS. Is this something doable?
...ANSWER
Answered 2022-Mar-02 at 14:28JMS topics, generally speaking, provide publish-subscribe semantics in which every consumer/subscriber gets every message sent to the topic. However, there is a way to get point-to-point semantics with multiple consumers on a JMS topic - shared subscriptions.
Shared subscriptions are available from JMS 2 onward. When using this feature multiple consumers/subscribers can share the same subscription and only one of those consumers will receive a given message.
The simplest way to create a shared subscription is by using javax.jms.Session.createSharedConsumer()
. This will create a shared, non-durable subscription and unlike when creating a durable subscription setting the client ID on the connection is optional. There are other related methods for creating shared, durable subscriptions, using selectors, etc.
In short, as long as all the consumers are creating a shared subscription using the same subscription name then you can get the point-to-point semantics you need.
QUESTION
I have a use case where I need to convert a message from one type to another (i.e. TextMessage
-> ObjectMessage
).
I found that when diverting between queues there is an option to transform the message. I have implemented the Transformer
interface as instructed in the documentation.
ANSWER
Answered 2022-Feb-02 at 17:23It should technically be possible to convert a javax.jms.TextMessage
to a javax.jms.ObjectMessage
, but it may be cumbersome. Here are some important things to note:
javax.jms.TextMessage
,javax.jms.ObjectMessage
, andorg.apache.activemq.artemis.api.core.Message
are all just interfaces. Thejavax
version is what you use on the client andMessage
is what is used on the broker. The data for each type of message is stored differently in the underlying message implementation.- The class for the Java object that you wish to put into the
ObjectMessage
will need to be on the broker's classpath. This isn't required under normal circumstances as the broker itself will never serialize or deserialize the object. - You should really try to avoid
ObjectMessage
whenever possible.ObjectMessage
objects depend on Java serialization to marshal and unmarshal their object payload. This process is generally considered unsafe (and slow!), because a malicious payload can exploit the host system. Lots of CVEs have been created for this. For this reason, most JMS providers force users to explicitly whitelist packages that can be exchanged usingObjectMessage
messages. For example, here's the related documentation for ActiveMQ Artemis. There are a number of other issues with using JMSObjectMessage
not related to security that you should read about.
Granted you understand all that you should be able to convert the message using code something like this:
QUESTION
With regard to the Log4j JNDI remote code execution vulnerability that has been identified CVE-2021-44228 - (also see references) - I wondered if Log4j-v1.2 is also impacted, but the closest I got from source code review is the JMS-Appender.
The question is, while the posts on the Internet indicate that Log4j 1.2 is also vulnerable, I am not able to find the relevant source code for it.
Am I missing something that others have identified?
Log4j 1.2 appears to have a vulnerability in the socket-server class, but my understanding is that it needs to be enabled in the first place for it to be applicable and hence is not a passive threat unlike the JNDI-lookup vulnerability which the one identified appears to be.
Is my understanding - that Log4j v1.2 - is not vulnerable to the jndi-remote-code execution bug correct?
ReferencesThis blog post from Cloudflare also indicates the same point as from AKX....that it was introduced from Log4j 2!
Update #1 - A fork of the (now-retired) apache-log4j-1.2.x with patch fixes for few vulnerabilities identified in the older library is now available (from the original log4j author). The site is https://reload4j.qos.ch/. As of 21-Jan-2022 version 1.2.18.2 has been released. Vulnerabilities addressed to date include those pertaining to JMSAppender, SocketServer and Chainsaw vulnerabilities. Note that I am simply relaying this information. Have not verified the fixes from my end. Please refer the link for additional details.
...ANSWER
Answered 2022-Jan-01 at 18:43The JNDI feature was added into Log4j 2.0-beta9.
Log4j 1.x thus does not have the vulnerable code.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install jms
You can use jms like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the jms component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page