This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

AnnouncementAnnouncement Module

Collapse

No announcement yet.

Not able to run an example with org.springframework.amqp.rabbit.core.RabbitTemplat ePage Title Module

Comment

Are you talking about the Hello World sample? Our goal there was to keep it as simple and clear as possible. Can you elaborate on what you find "clumsy"?

Thanks,
Mark

okay, let me explain it :

I have to run an asynch pub-sub mechanism as given in hello world sample..

We have the following java files:
1. Producer....it's using ProducerConfiguration (ProducerConfiguration class contains the code which I can not understand, as I am new to spring...I think that we can do these configurations through rabbitConfiguration.xml file and that would be understandable)
2. Consumer.......it's using ConsumerConfiguration directly and HelloWorldHandler/HelloWorldConfiguration indirectly (ConsumerConfiguration and HelloWorldConfiguration classes can be again configured through rabbitConfiguration.xml file and that would be understandable)

Can you please help me transferring this configurations to rabbitConfiguration.xml and explain?

As for the question about "topics", AMQP has a different model and different terminology. One important point is the distinction between Exhanges and Queues. Please refer to the AMQP Specification for an overview:http://www.amqp.org/confluence/displ...+Specification (I would recommend reading about Exchanges in version 0-9-1).

Comment

I have gone through the code and the links suggested by you. I am in the process of transferring all the configuration code from java to xml file for the hello world example. I have a doubt with the ConsumerConfiguration class. You have defined listenerContainer() in ConsumerConfiguration class which is returning a SimpleMessageListenerContainer object. Now I am not able to find out that who is using that SimpleMessageListenerContainer object in the hierarchy of ConsumerConfiguration class? I have to map this object to something in my xml config file. Message is correctly being sent to the Broker but nothing happens when I run my Consumer.

<!-- Since the AMQP Admin knows about the connectionFactory,
we can create a queue on Rabbit Broker using the RabbitTemplate provided by Spring framework-Rabbit APIs -->
<bean id="rabbitTemplate" class="org.springframework.amqp.rabbit.core.Rabbit Template"
p:connectionFactory-ref="connectionFactory" p:queue="hello.world.queue" />

<!-- With the help of all the configurations mentioned above this line, a producer can simply use an
amqp template in its java file to publish anything on the that queue only ??
Question is that how and why an amqp template objects sends the notification only on that queue? -->

<!-- pass a new instance of that consumer handler as a constructor argument to a messageListenerAdaptor object-->
<bean id="messageListenerAdaptor" class="org.springframework.amqp.rabbit.listener.ad apter.MessageListenerAdapter">
<constructor-arg ref="consumerHandler"/>
</bean>

/* We have retrieved an amqpTemplate from the context.
* Producer can simply use that amqp template to publish anything.
* Question is that how and why this amqp template object
* sends the notification only on queue which we have declared through Admin class
* where is this mapping present ? */