Call consumer.close()

On Mon, Sep 16, 2013 at 12:09 AM, hanumath <grand...@infratab.in> wrote:

> Hi All,
>
>    we have 10 messages in Activemq and 2 consumers. consumers starting to
> consume and processing messages If I trigger consumers corresponding links
> at initial time.For this I wrote the following code
>
> *ActiveMQConnectionFactory connectionFactory=new
>
> ActiveMQConnectionFactory("admin","admin","tcp://localhost:61617?jms.prefetchPolicy.queuePrefetch=1");
> Connection connection=connectionFactory.createConnection();
> final Session session=connection.createSession(true,
> Session.CLIENT_ACKNOWLEDGE);
> Queue queue=session.createQueue("ThermalMap");
> javax.jms.MessageConsumer consumer=session.createConsumer(queue);
> //anonymous class
> MessageListener listener = new MessageListener() {
>                 @Override
>                 public void onMessage(Message msg) {
>                  // My business code
>                 }
> };
> *
>
>
> I deployed this entire Application in *Apache Tomcat*.
>
> Now, Consumers continuously consuming messages If any client sends message
> to Activemq. so far it's fine.
>
> Later If I want to stop consuming messages by consumers without stoping
> *webserver(Apache Tomcat)*.
>
> How can I achieve this.
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/What-are-the-uses-of-Durable-Subscribers-tp4671512.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Reply via email to