[rabbitmq-discuss] To declare a MQ listener at java application startup
Jon Brisbin
jon.brisbin at npcinternational.com
Mon Aug 9 22:56:47 BST 2010
Have you looked at "basicConsume" on the Channel object?
http://www.rabbitmq.com/releases/rabbitmq-java-client/v1.8.0/rabbitmq-java-client-javadoc-1.8.0/com/rabbitmq/client/Channel.html
Or do you mean: "more specifically, how do you manage multi-threading issues when managing consumers"?
The latter is a black hole of a topic. :)
The API guide, though Spartan, is a good starting point:
http://www.rabbitmq.com/api-guide.html#consuming
Jon Brisbin
Portal Webmaster
NPC International, Inc.
On Aug 9, 2010, at 1:15 PM, archana v wrote:
> i declare something like this
>
> <servlet>
> <servlet-name>MQListenerServlet</servlet-name>
> <display-name>MQListenerServlet</display-name>
> <servlet-class>com.ssmi.admin.MQ.MQListenerTest</servlet-class>
>
> <load-on-startup>6</load-on-startup>
> </servlet>
>
>
> but in my class file i am not sure as to how to declare the listner. Should i use the java Thread or is there a default method like addlistener or somethin in rabbit MQ.
>
> On Mon, Aug 9, 2010 at 1:52 PM, Jon Brisbin <jon.brisbin at npcinternational.com> wrote:
> On Aug 9, 2010, at 12:47 PM, archana v wrote:
>
>> Thanks for your reply.I am not using spring.. I am trying to configure it at servlet init. But it doesn seem to work. I dont know if my method of declaring the listener is right. It would be helpful if you could send me some samples.
>
> Sorry, I don't have any example of using servlet init because I use Spring.
>
> Maybe you could show a little of what you're trying to do?
>
> Are you including <load-on-startup>1</load-on-startup> in your servlet init?
>
> jb
>
>
>>
>>
>> Thanks and Regards,
>> Archana
>>
>> On Mon, Aug 9, 2010 at 1:43 PM, Jon Brisbin <jon.brisbin at npcinternational.com> wrote:
>> There's actually a lot of ways to go about this:
>>
>> 1) If you're using Spring, then just configure a bean in your app-context.xml.
>>
>> 2) You could use the new spring-amqp classes: http://www.springsource.org/spring-amqp
>>
>> 3) You could manually configure them from the servlet init method.
>>
>> I also run listeners that integrate with the Tomcat server. You can configure them in different ways depending on the context. You could set up a global naming resource, or you could scope it to your web application by putting it in META-INF/context.xml: http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html
>>
>> Jon Brisbin
>> Portal Webmaster
>> NPC International, Inc.
>>
>>
>>
>> On Aug 9, 2010, at 11:33 AM, archana v wrote:
>>
>>> Hi All,
>>>
>>> I am new to rabbit-mq. I would like to know how to start a MQ listner(Java Client) to listen to a queue at the application start up. I am deploying my application in tomcat server.
>>> Thanks in advance for your help.
>>>
>>>
>>> Thanks and Regards,
>>> Archana
>>> _______________________________________________
>>> rabbitmq-discuss mailing list
>>> rabbitmq-discuss at lists.rabbitmq.com
>>> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20100809/26e9ea30/attachment-0001.htm>
More information about the rabbitmq-discuss
mailing list