tag:blogger.com,1999:blog-6026073423954662509.post6043040076910427392..comments2023-04-05T16:46:09.400+02:00Comments on Xavier Padró's Blog: Introduction to messaging with Spring JMSAnonymoushttp://www.blogger.com/profile/05830415740156192526noreply@blogger.comBlogger25125tag:blogger.com,1999:blog-6026073423954662509.post-51852940736324397962016-04-23T15:01:53.574+02:002016-04-23T15:01:53.574+02:00Hi, any tips is appreciated.
I have the following ...Hi, any tips is appreciated.<br />I have the following error on my Eclipse application using Spring 3.2.13: <br /><br />WARN 2016-04-22 15:58:07,108 [alerts_message_receiver_container-1] DefaultMessageListenerContainer: Setup of JMS me<br />ssage listener invoker failed for destination 'alerts' - trying to recover. Cause: Object org.apache.qpid.<br />client.AMQSession has been closed<br />INFO 2016-04-22 15:58:07,114 [alerts_message_receiver_container-1] AMQConnection: Connection 2 now connected from<br /><br />bean id="alerts_jmsConnectionFactory" class="org.apache.qpid.client.AMQConnectionFactory"><br /> constructor-arg<br /> value="amqp://guest:guest@/test?brokerlist='tcp://${host.name}:${jms.port}?retries=9999&connectdelay=30000'&connecttimeout='5000'&maxprefetch=10" /><br /> /bean><br /><br /><br /> bean id="alerts_jmsCachedConnectionFactory"<br /> class="org.springframework.jms.connection.CachingConnectionFactory"><br /> property name="targetConnectionFactory" ref="alerts_jmsConnectionFactory" /><br /> property name="sessionCacheSize" value="3" /><br /> /bean><br /><br /> <br /> <br /> bean id="alerts_destination" class="org.apache.qpid.client.AMQTopic"><br /> <br /> <br /><br /> bean id="alerts_messageProducer"<br /> class="message.producers.Alert_MessageProducer"><br /> property name="jmsTemplate" ref="alerts_jmsTemplate" /><br /> /bean><br /><br /> bean id="alerts_jmsTemplate" class="org.springframework.jms.core.JmsTemplate"><br /> property name="connectionFactory" ref="alerts_jmsCachedConnectionFactory" /><br /> property name="defaultDestination" ref="alerts_destination" /><br /> property name="SessionAcknowledgeModeName" value="CLIENT_ACKNOWLEDGE" /><br /> property name="sessionTransacted" value="true" /><br /> /bean><br /><br /><br /> <br /> bean id="defaultMessageReceiver"<br /> class="message.receivers.DefaultMessageReceiver" /><br /><br /><br /> bean id="alerts_message_receiver_container"<br /> class="org.springframework.jms.listener.DefaultMessageListenerContainer"><br /> property name="connectionFactory" ref="alerts_jmsCachedConnectionFactory" /><br /> property name="destinationName" value="${alerts.topic}" /><br /> property name="messageListener" ref="defaultMessageReceiver" /><br /> /bean>Springhttps://www.blogger.com/profile/14365213863073595816noreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-20769557387197417182015-12-02T14:02:44.833+01:002015-12-02T14:02:44.833+01:00Hi. Thanks for the good job.
I could'not see ...Hi. Thanks for the good job.<br /><br />I could'not see the difference in configuration between sync and async delivery. What make exactly in the delivery async in your code ?<br /><br />Thanks in advanceAnonymoushttps://www.blogger.com/profile/17345096444421824035noreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-60748975709433542082015-08-24T23:17:52.200+02:002015-08-24T23:17:52.200+02:00Hi Manu and thanks! :)
Setting the "concurre...Hi Manu and thanks! :)<br /><br />Setting the "concurrency" property to the listener container is the way to set multiple concurrent consumers. You can also specify a value of min-max to let Spring dynamically scale it up when message load increases. However, as stated in the reference, it is recommended to keep this value to 1 when using topics, since it may lead to receiving the same message multiple times (all consumers subscribed to a topic will receive each message).<br /><br />If message order is not important in your scenario, I think you could consider using a queue with concurrent consumers.Anonymoushttps://www.blogger.com/profile/05830415740156192526noreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-88788888374647507622015-08-23T03:32:54.257+02:002015-08-23T03:32:54.257+02:00Hi Xavi, great blog!!
I am developing a JMS Subsc...Hi Xavi, great blog!!<br /><br />I am developing a JMS Subscriber for a data intensive application (Big Data!). As you know, finding the right balance between performance and resources usage is vital to success. <br /><br />I need to configure concurrent consumers from a topic, in order to avoid a bottleneck while processing each received message. Lets say I need 10 consumers, so I could set "concurrency=10" in the listener, and change the CachingConnectionFactory session_cache_size to 10, to guarantee one TCP connection per consumer. <br /><br />Is this approach OK? Is there any other parameter I should keep in mind?<br /><br /><br />Thanks and congrats!!!Manuhttps://www.blogger.com/profile/17926497355243742027noreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-38392978185316055762015-04-03T10:27:40.888+02:002015-04-03T10:27:40.888+02:00Hi CameraCrazy,
This Notification class is one th...Hi CameraCrazy,<br /><br />This Notification class is one that I defined. You can find its source code at github:<br />https://github.com/xpadro/spring-integration/blob/master/jms-basic/src/main/java/xpadro/spring/jms/model/Notification.java<br /><br />Good luck with your learning! ;)Anonymoushttps://www.blogger.com/profile/05830415740156192526noreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-61048901433986994262015-04-01T15:13:40.693+02:002015-04-01T15:13:40.693+02:00Hi Xavier - I am just learning Spring and JMS and ...Hi Xavier - I am just learning Spring and JMS and was attempting to learn from your example but could not get the Notification object to work. In your post you send only 2 parameters when creating the Notification object but when I look for that class it comes up in javax.management and has more arguments. Can you please explain this line:<br /><br />Notification notification = new Notification("1", "this is a message");<br /><br />Thank you<br />CameraCrazyhttps://www.blogger.com/profile/01476450004637743023noreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-50435575911220389802014-08-09T16:47:30.896+02:002014-08-09T16:47:30.896+02:00No problem, I am going to share your work anyway o...No problem, I am going to share your work anyway on FB, excellent material. Thanks again by your work!Manuel Jordanhttp://manueljordanelera.blogspot.com/2014/06/manuel-jordan.htmlnoreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-32533346705579249372014-08-09T08:52:50.514+02:002014-08-09T08:52:50.514+02:00Manuel, thank you for the invitation but, as weird...Manuel, thank you for the invitation but, as weird as it may seem, I don't currently have Facebook! I will think about it. Regarding the twitter account, my twitter handle is @xavips. Best regards.Anonymoushttps://www.blogger.com/profile/05830415740156192526noreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-22824613758661535962014-08-08T18:36:35.540+02:002014-08-08T18:36:35.540+02:00I invite you to be a member at "https://www.f...I invite you to be a member at "https://www.facebook.com/groups/springsource/" I think is fair if you are part of the community and let us read your pretty cool tutorials! Let me know if you have a twitter account. Kind Regards.Manuel Jordanhttp://manueljordanelera.blogspot.com/2014/06/manuel-jordan.htmlnoreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-35730717465762729572014-08-07T10:21:29.796+02:002014-08-07T10:21:29.796+02:00Many thanks Manuel, I appreciate you share it :)Many thanks Manuel, I appreciate you share it :)Anonymoushttps://www.blogger.com/profile/05830415740156192526noreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-61794886950067936762014-08-07T00:06:20.541+02:002014-08-07T00:06:20.541+02:00Thanks by tutorial, very valuable and elegant. I a...Thanks by tutorial, very valuable and elegant. I am going to share this tutorial this weekend through twitter and SpringSource group in facebook.Manuel Jordanhttp://manueljordanelera.blogspot.com/2014/06/manuel-jordan.htmlnoreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-3463049845357943622014-02-05T17:45:23.511+01:002014-02-05T17:45:23.511+01:00Thank you jackcd1, I am very pleased that it was h...Thank you jackcd1, I am very pleased that it was helpful to you. I appreciate your words :)Anonymoushttps://www.blogger.com/profile/05830415740156192526noreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-21463423431573120282014-02-05T06:29:53.699+01:002014-02-05T06:29:53.699+01:00Extremely helpful. Even more so than Spring's...Extremely helpful. Even more so than Spring's documentation and parts of the Spring in Action book.jackcd1https://www.blogger.com/profile/05000364827752321127noreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-39002311469414046292014-01-20T09:37:08.653+01:002014-01-20T09:37:08.653+01:00Hi Xavier,
We couldn't figure out what the pro...Hi Xavier,<br />We couldn't figure out what the problem was, but when we used virtual topic instead of regular topic, it seemed to solve the issue.Ayeletnoreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-80788509932137935052014-01-13T12:25:20.235+01:002014-01-13T12:25:20.235+01:00Hi Ayelet,
I've added a test called "Tes...Hi Ayelet,<br /><br />I've added a test called "TestIterateToTopic" to my project, but doesn't seem to reproduce your issue since all messages are being received by the consumer. I'm using a local JMS transaction. Maybe, as you noted in SO, could be something with Atomikos configuration. I'm sorry for not being more helpful.<br /><br />Please, let me know if you find what's wrong.Anonymoushttps://www.blogger.com/profile/05830415740156192526noreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-14794122140082520922014-01-12T15:09:09.666+01:002014-01-12T15:09:09.666+01:00Hi Xavier,
Thank you very much for this helpful an...Hi Xavier,<br />Thank you very much for this helpful and useful post!<br />We're trying to configure our application to use JMS topics, but it seems that some of the messages get lost and don't get consumed (it doesn't happen when we use queues).<br />For detailed information see my post: http://stackoverflow.com/questions/21073479/activemq-with-jms-topic-some-messages-not-dequeued-by-consumer<br />Do you maybe have an idea what could be the problem? Any help would be very much appreciated. :)<br />Thanks!Ayeletnoreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-71357234490971861642014-01-03T15:46:01.061+01:002014-01-03T15:46:01.061+01:00Thanks for the explanation, as I expected, :), in ...Thanks for the explanation, as I expected, :), in fact, I never used by type in real world. <br /><br />I like your blogs very much! Hope you keep on.<br /><br />Happy New Year!Ziyang Liuhttps://www.blogger.com/profile/09509541619574241646noreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-35248954062485340122014-01-03T00:42:10.443+01:002014-01-03T00:42:10.443+01:00Hi Ziyang,
Thanks to you for reading it :)
What ...Hi Ziyang,<br /><br />Thanks to you for reading it :)<br /><br />What I am doing in TestDynamicReceiver is autowiring by type. This means it will look at the Spring container for a bean of type javax.jms.Topic. If you review the config file "jms-config.xml", you will notice that there's only one qualifying bean, which is testTopic (ActiveMQTopic implements javax.jms.Topic). The other two destinations implement javax.jms.Queue.Anonymoushttps://www.blogger.com/profile/05830415740156192526noreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-42125991901492679082014-01-02T20:47:48.170+01:002014-01-02T20:47:48.170+01:00Thanks Xavier for this great blog!
Just another qu...Thanks Xavier for this great blog!<br />Just another question about this dynamic subscriber code, <br />Where this destination @Autowired from? I don't see this anywhere, how does TestDynamicTopicReceiver know it is "test.topic"?<br /><br />@Autowired<br />private Topic destination;<br />Ziyang Liuhttps://www.blogger.com/profile/09509541619574241646noreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-89137280475586764582013-11-15T21:03:20.449+01:002013-11-15T21:03:20.449+01:00Hi Nagarjuna,
Thanks for your feedback, I appreci...Hi Nagarjuna,<br /><br />Thanks for your feedback, I appreciate it. I will try to answer your question:<br /><br />In synchronous reception you can see the destination defined as a queue named "test.sync.queue" (3.1.1 section). That's the bean named syncTestQueue. This bean is configured in the jmsTemplate as its default destination, so when you use the template to send a message, you can skip the destination and it will use the default (see the producer in 3.1.2 section). On the other hand, the consumer (section 3.1.3) receives the message from the queue passed to the jmsTemplate. The template will use its destination resolver to resolve the name passed to a JMS destination.<br /><br />In asynchronous reception, the mechanism is the same.<br /><br />Did I answer your question?Anonymoushttps://www.blogger.com/profile/05830415740156192526noreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-32752730608072567722013-11-15T06:31:24.147+01:002013-11-15T06:31:24.147+01:00Hi i am Nagarjuna, superb work, no words to say si...Hi i am Nagarjuna, superb work, no words to say simply superb explined perfectly.<br />I have a doubt how you configured destination and where you created.<br />Thank youAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-65927133508739177452013-11-10T18:55:30.250+01:002013-11-10T18:55:30.250+01:00I'm glad you liked it!I'm glad you liked it!Anonymoushttps://www.blogger.com/profile/05830415740156192526noreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-59713166222530541532013-11-10T11:31:21.538+01:002013-11-10T11:31:21.538+01:00Thanks for this lovely work.Thanks for this lovely work.Hello Fidessahttps://www.blogger.com/profile/16204247558809677519noreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-67605792373957348722013-09-24T12:30:18.095+02:002013-09-24T12:30:18.095+02:00You can create a dynamic subscriber programmatical...You can create a dynamic subscriber programmatically from the session, which is created from your injected connection factory:<br /><br />Connection con = connectionFactory.createConnection();<br />Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);<br />MessageConsumer consumer = session.createConsumer(destination);<br /><br />Then you just need to define a listener for the consumer you've just created. <br /><br />I've added a test case named TestDynamicTopicReceiver to my source code. You can check it here:<br /><br /> https://github.com/xpadro/spring-integration/tree/master/jms-basic<br />Anonymoushttps://www.blogger.com/profile/05830415740156192526noreply@blogger.comtag:blogger.com,1999:blog-6026073423954662509.post-55326939883559540882013-09-24T05:05:31.507+02:002013-09-24T05:05:31.507+02:00How do i add programmatically or dynamically suscr...How do i add programmatically or dynamically suscribers to the JMS topic? can i reference the topic with the session object and add listeners?Angel Lacrethttps://www.blogger.com/profile/00467084990591364133noreply@blogger.com