activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Gies <andr...@wayofquality.de>
Subject Re: How to get the message from temporary Queue in Different session
Date Wed, 06 Nov 2013 08:48:04 GMT
Hi,

as was said earlier the lifespan of the temporary queue is controlled by 
the
ActiveMQ runtime -  more specifically the connection that was used to 
create
the temporary destination.

If that doesn't suite your need I think you may have an architecture 
problem.
Is a temporary queue with it's limited lifespan really what you need ? 
 From what
I see you have a simple request / reply scenario, so it might suffice.

However, if you need your replies to survive broker failures or 
reconnects, a temp
queue is not what you are looking for.

Best regards
Andreas


On 11/06/2013 08:32 AM, nixen09 wrote:
> Hi
>
> Thanks for the reply.I will explain my workflow
>
>         request (publishing)       Consuming
> *client*------------------>*activemq*---------------->*service*
>            <-----------------                      <-----------------
>            Reply                                      Reply back to temp
> queue
>
> In Client when i create a consumer for temporary queue the consumer give a
> point to temporary queue that was created in the session.it will be a
> synchronize process.after that it will produce the message to
> broker(activemq). Then service consume the message and reply back to temporary
> queue .  i read many article about temporary queue ,all are specifying the
> consumer will be in the same session or connection.
> when i push one message to activemq , i can see the temporary queue in
> activemq . when service consume the message , the temporary queue
>   disappearing but i got result when consumer on the same session or
> connection. when i tried to get the message using temporary queue name ,its
> creating new queue because the temporary queue  is not there. so how can i
> increase the life span of temporary queue ?
> i think u got my point.if any query please feel free to reply back. Thanks
> Advance
>
> Regards
> Nixon
>
>
>
> On Tue, Nov 5, 2013 at 7:46 PM, ceposta [via ActiveMQ] <
> ml-node+s2283324n4673900h96@n4.nabble.com> wrote:
>
>> You should always use the name provided by JMSReplyTo header. It
>> shouldn't make a difference which session you're using. Temporary
>> destination lifecycle (creation, and removal) are tied to the
>> connection that created it, so you'd have to verify the connection is
>> still around when you're using the temporary destination.
>>
>> On Tue, Nov 5, 2013 at 2:09 AM, nixen09 <[hidden email]<http://user/SendEmail.jtp?type=node&node=4673900&i=0>>
>> wrote:
>>
>>> i am new to jms and activemq. i produce one message to one static queue
>> in
>>> activemq and get reply back to temporary queue using getJMSReplyTo. the
>> code
>>> is following
>>>
>>> ActiveMQConnectionFactory connectionFactory = new
>>> ActiveMQConnectionFactory("tcp://localhost:61616");
>>>
>>>      // Create a Connection
>>>      Connection connection = connectionFactory.createConnection();
>>>      connection.start();
>>>
>>>      // Create a Session
>>>      Session session = connection.createSession(false,
>>> Session.AUTO_ACKNOWLEDGE);
>>>
>>>
>>>      // Create the destination (Topic or Queue)
>>>      Destination destination = (Destination)
>>> session.createQueue("PostWithParameter_Queue");
>>>
>>>      // Create a MessageConsumer from the Session to the Topic or Queue
>>>      MessageConsumer consumer = session.createConsumer(destination);
>>>      //consumer.setMessageListener(new StaticQueueListener());
>>>      // Wait for a message
>>>      Message message = (Message) consumer.receive();
>>>      MessageConsumer consumer1 =
>>> session.createConsumer(message.getJMSReplyTo());
>>>      consumer1.setMessageListener(new ReplyHandler());
>>>      consumer.close();
>>>      session.close();
>>>
>>> My Reply Handler follows
>>>
>>> @Override
>>> public void onMessage(Message message) {
>>>
>>>      try
>>>      {
>>>
>>>          System.out.println(message.getStringProperty("status"));
>>>      }
>>>      catch (JMSException e)
>>>      {
>>>              e.printStackTrace();
>>>      }
>>> }
>>>
>>> Now i am getting the result from temporary queue. because its in the
>> same
>>> session. my question is i want to get the message from temporary queue
>> in
>>> differesnt session using temporary queue name. if i want to get the
>> message
>>> from temporary queue in different client using temporary queue name how
>> i
>>> will do that ? .
>>> when i try to do that in normal way it creating one queue.
>>>
>>>
>>>
>>> --
>>> View this message in context:
>> http://activemq.2283324.n4.nabble.com/How-to-get-the-message-from-temporary-Queue-in-Different-session-tp4673886.html
>>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
>> --
>> Christian Posta
>> http://www.christianposta.com/blog
>> twitter: @christianposta
>>   http://www.christianposta.com/blog
>>
>>
>> ------------------------------
>>   If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://activemq.2283324.n4.nabble.com/How-to-get-the-message-from-temporary-Queue-in-Different-session-tp4673886p4673900.html
>>   To unsubscribe from How to get the message from temporary Queue in
>> Different session, click here<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4673886&code=bml4ZW4wOUBnbWFpbC5jb218NDY3Mzg4NnwtMjQ2NDA2NDA0>
>> .
>> NAML<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>

-- 


    Andreas Gies

WoQ -- Way of Quality UG

Geschäftsführer & CTO

/eMail:/andreas@wayofquality.de <mailto:andreas@wayofquality.de>

/Tel:/ +49 151 23470823

/Fax:/ +49 1805 006534 2114

/Twitter:/ andreasgies /Skype:/ giessonic

/LinkedIn:/ <http://de.linkedin.com/pub/andreas-gies/0/594/aa5/> 
(http://de.linkedin.com/pub/andreas-gies/0/594/aa5/)

/Xing:/ <http://www.xing.com/profile/Andreas_Gies> 
(http://www.xing.com/profile/Andreas_Gies)

/Blog:/ <http://www.wayofquality.de/index.php/en/blog> 
(http://www.wayofquality.de/index.php/en/blog)

/Github:/ <https://github.com/atooni> (https://github.com/atooni)

/Amtsgericht Landshut:/HRB 8352//

//

/Ust.-Id.:/ DE274771254


      Haftungsausschluss

Diese Email kann vertrauliche und/oder rechtlich geschützte 
Informationen enthalten und ist ausschließlich für den/die benannten 
Adressaten bestimmt. Sollten Sie nicht der beabsichtigte Empfänger sein 
oder diese Email irrtümlich erhalten haben, ist es Ihnen nicht gestattet 
diese Mail oder einen Teil davon ohne unsere Erlaubnis zu verbreiten, zu 
kopieren, unbefugt weiterzuleiten oder zu behalten. Informieren Sie 
bitte sofort den Absender telefonisch oder per Email und löschen Sie 
diese Email und alle Kopien aus Ihrem System. Wir haften nicht für die 
Unversehrtheit von Emails, nachdem sie unseren Einflussbereich verlassen 
haben.


      Disclaimer

This email may contain confidential and/or privileged information and is 
intended solely for the attention and use of the named addressee(s). If 
you are not the intended recipient, or a person responsible for 
delivering it to the intended recipient, you are not authorized to and 
must not disclose, copy, distribute, or retain this message or any part 
of it without our authority. Please contact the sender by call or reply 
email immediately and destroy all copies and the original message. We 
are not responsible for the integrity of emails after they have left our 
sphere of control.

//

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message