FAQ Database Discussion Community


Using topics but not all the consumers take the message

spring,jms,activemq,spring-jms,jmstemplate
I want to create a sender to generate message and the send it to all consumers. I am using topic, but something is wrong, if for example I have 3 consumers, only one takes the message in a random way. I donĀ“t know what is wrog. Here is my server...

IBM MQ ISSUE in Apache Camel because Spring JMS Listener

apache-camel,activemq,ibm,spring-jms
I am new to IBM MQ with Apache camel. below is my configuration <from IBM MQ> <parallel> <to ACTIVE MQ> <to IBM MQ> </parallel> my application is running in Spring Container. some time I am getting this below warning, hence My route is not working ( IBM MQ is not...

MQ connection throwing null pointer during context.lookup in tomcat

jms,jndi,spring-jms,initial-context
I am trying to connect to MQ using JNDI lookup defined in context.xml of tomcat. While starting the application, i am getting a NamingException and a NullPointer in FFDC. Below is what logged. I am not able to make out what is wrong. Any indication on how to debug this...

message-driven-channel-adapter deadlock issues

spring-integration,websphere-mq,spring-jms
I have this deadlock scenario which brings the application to a complete halt, not sure whats going on, if you could show some light. Thank you This is the consumer configuration <jms:message-driven-channel-adapter id="InBoundZFlow" connection-factory="wmqConnFactory" destination="ResponseQueue" channel="responseInChannel" auto-startup="false" max-messages-per-task="20" receive-timeout="10000" concurrent-consumers="2" task-executor="receivingTaskExecutor" max-concurrent-consumers="20" idle-consumer-limit="1"...

ActiveMQ and prefetch limit

jms,activemq,spring-jms
I want to understand how ApacheMQ's prefetch limit works. Are all the messages sent in one burst? What if there are concurrent consumers, what happens then? What is the difference between prefetch limit of 0 and 1?...

DMLC message consumption and acknowledgement

spring,jms,activemq,spring-jms,message-listener
This is a follow up question for Difference between AUTO_ACKNOWLEDGEMENT mode with and without Spring JMS. I am using DMLC and my concurrent consumers count is 1. The prefetch limit is > 1. I received a message and it is acknowledged before listener is executed. So, while the listener is...

how to create JMS queues in run-time using Spring JMS support?

java,spring,jms,spring-jms
I need to dynamically create JMS queues during runtime. Is it possible to do this with the Spring JMS support (JmsTemplate?)? and how? code examples or references would be greatly appreciated. Update: It turns out that it is not possible to create physical destinations through the JMS API, so I...

How exactly works JMS queue (point to point message)?

java,spring,java-ee,jms,spring-jms
I am studying for the Spring Core certification and I have some doubt about how JMS works and about how Spring handle it. So I know that the JMS Core Components are: Message Destination Connection Session MessageProducer MessageConsumer From what I have understand a Message is what is send and...

@JmsListener usage for publish-subscribe topic

spring,spring-jms
I am trying to create example for publish-subscribe based on @JmsListener annotation: https://github.com/lkrnac/book-eiws-code-samples/tree/master/05-jms/0515-publish-subscribe Relevant code snippets: @Slf4j @SpringBootApplication @EnableScheduling public class JmsPublishSubscribeApplication { public static void main(String[] args) throws InterruptedException { SpringApplication.run(JmsPublishSubscribeApplication.class, args); } @Bean public ActiveMQTopic simpleTopic() { return new ActiveMQTopic("simpleTopic"); } } @Component public class...

Spring JMS Consumer Application

java,spring,spring-jms
I have created a JMS broker with Apache ActiveMQ and a simple application that enqueues messages ok. I would like to create another simple application that dequeues those messages asynchronously using an MDP. Here's an example of what I have so far: Consumer POJO import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageListener;...

Error in setExceptionListener in sending message via JmsTemplate to ActivemQ (as external broker of Jboss-eap)

spring,jms,activemq,spring-jms,jboss-eap-6
Based on this article, I've connected Jboss eap 6.2 to an external ActivemQ 5.9.0. For sending/receiving message i'm using JmsTemplate and DefaultMessageListenerContainer in spring-jms 4.1.1. Receiving message is working fine, but in sending message i get this error: 11:33:37,059 ERROR [stderr] java.lang.reflect.InvocationTargetException 11:33:37,060 ERROR [stderr] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 11:33:37,060 ERROR...

messagebased RPC with topic

spring,jms,spring-integration,messaging,spring-jms
A simple message-based RPC is very easy to create. The server side exports the service, the client side uses a proxy. What is the best way, to make the same thing with multiple repliers? I want to send a request from a client. Then the client waits while all (maybe...

Difference between AUTO_ACKNOWLEDGEMENT mode with and without Spring JMS

jms,messaging,spring-jms
I am trying to understand how acknowledgement modes work in JMS. I was reading this source and it hugely confused me as it was contradicting what Spring's documentation says. Sources saying one thing: From http://www.javaworld.com/article/2074123/java-web-development/transaction-and-redelivery-in-jms.html A message is automatically acknowledged when it successfully returns from the receive() method. If the...

Spring Integration with JMS + ActiveMQ: Messages remain in JDBC Message Store after reconnect

java,activemq,spring-integration,spring-jms
I'm trying to configure JMS with Spring Integration and an ActiveMQ Message Broker. My outbound channel should be backed by a JDBC Message Store to prevent data loss e.g. the broker or my application goes offline. My configuration seems to work so far, however the JDBC Message Store does not...

Notify ActiveMQ producer if consumer on the destination is down

spring,jms,activemq,spring-jms
I am using ActiveMQ messaging broker and I have a requirement where the producer application would want to know if the consumer application consuming on the particular destination is up or not? How can I achieve this? Thanks!...

How to define max queue size using Spring-JMS

java,spring,jms,activemq,spring-jms
I followed Spring-boot article to define local activemq: https://spring.io/guides/gs/messaging-jms/ I would like to set the queue size(for X times). so when producer try to enqueue new times it will get expcetion in case the size is on it's limit How could I define that? thank you....

How exactly works this configuration that definies the JMS infrastracture into a Spring application?

java,spring,spring-mvc,jms,spring-jms
I am doing some exercises on JMS in Spring and I have some doubt. Into the solution of an exercise I have this configuration class named JmsInfrastructureConfig: package config; import javax.jms.ConnectionFactory; import javax.jms.Destination; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.command.ActiveMQQueue; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class JmsInfrastructureConfig { /** * Create a...

Error while setting targetConnectionFactory in UserCredentialsConnectionFactoryAdapter Spring 4

java,spring,jms,spring-boot,spring-jms
We are receiving a compilation error in the following code, while trying to set the targetConnectionFactory. According to the example given in Spring 4 documentation for UserCredentialsConnectionFactoryAdapter, the setTargetConnectionFactory() method takes the object of JndiObjectFactoryBean as an argument. But, looks like the JndiObjectFactoryBean hasn't implemented the 'ConnectionFactory' interface, which is...

Handle exceptions caused by message-converter on Message Driven Inbound Channel Adapter

java,spring-integration,spring-jms
In the configuration below I have a message-driven-channel-adapter with a message-converter so the service-activator is invoked with the converted payload. <int-jms:message-driven-channel-adapter id="myConsumerChannelAdapter" connection-factory="connectionFactory" destination="input_queue" channel="input_channel" error-channel="errorChannel" message-converter="messageConverter" header-mapper="jmsHeaderMapper" acknowledge="client" max-concurrent-consumers="10"/> <int:service-activator input-channel="input_channel"...

JMS Prefetch + Cached Consumers + Stuck Messages

java,spring,jms,activemq,spring-jms
I am trying to get JMS Consumers to work towards an ActiveMQ server however I am running into some issues which solution seem to just cause more problems. I am using Spring's DMLC (cacheLeve set to CACHE_CONNECTION) together with a CachingConnectionFactory (cachingConsumers set to true) wrapping Activemq's own ConnectionFactory in...

JmsTemplate and CachingConnectionFactory

jboss,jms,spring-jms,jmstemplate
I'm finding some difficulties in trying to reduce the connection and session creation when sending messages to a Jboss Queue. <bean name="jbmTemplate-${jbmQueue}" class="org.springframework.jms.core.JmsTemplate" lazy-init="true"> <property name="sessionTransacted" value="true" /> <!-- connection factory --> <property name="connectionFactory"> <ref bean="jbmCachingConnectionFactory"/> </property> <property name="pubSubDomain"> <value>false</value> </property> <property...

Publisher should wait till broker is available

spring,jms,spring-integration,spring-jms
I have a simple publisher, which sends messages to a queue. <int:channel id="publishChannel"/> <int-jms:outbound-channel-adapter channel="publishChannel" destination="testQueue" session-transacted="true"/> @Publisher(channel = "publishChannel") public String sendMessage (String text) { return text; } If the broker crashes, the publisher throws an MessageHandlingException. Is it possible to block the publisher, till the broker is available...