activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Bertram <>
Subject Re: msg.getJMSReplyTo().toString() and Session.createQueue(replyString)
Date Mon, 02 Oct 2017 19:18:32 GMT
Couple of things...

  1) I believe Tim is right that you might need to munge the queue name a
bit yourself to deal with portability issues.  Of
javax.jms.Session#createQueue, the JavaDoc says, "This facility is provided
for the rare cases where clients need to dynamically manipulate queue
identity. It allows the creation of a queue identity with a
provider-specific name. Clients that depend on this ability are not
portable."  Also, the JavaDoc says this about javax.jms.Queue#getQueueName,
"Clients that depend upon the name are not portable."

  2) I'm guessing the code you pasted previously won't actually compile as
javax.jms.Message#getJMSReplyTo returns a javax.jms.Destination which
doesn't have a getQueueName method.

  3) Since javax.jms.Message#getJMSReplyTo returns a javax.jms.Destination
why not just use that instead of using the String as a middleman to create
a javax.jms.Queue?


On Mon, Oct 2, 2017 at 1:46 PM, Tim Bain <> wrote:

> Session.createQueue() is defined as part of the JMS spec, and it's not a
> bug when it doesn't do things beyond the requirements of the spec.
> Just strip off the prefix yourself before you call it.
> Tim
> On Oct 2, 2017 5:15 AM, "boekhold" <> wrote:
> Hi,
> The following code fails:
> String replyDestStr = msg.getJMSReplyTo().toString();
> // forward the request asynchronously to a 3rd-party system, with
> // "replyDestStr" included in the 3rd-party request and response
> Queue replyQ = session.createQueue(replyDestStr);
> The problem is that the first line returns something like
> "queue://queuename", but the createQueue() call doesn't strip that off, and
> I end up posting to a queue that is *actually* called "queue://queuename".
> Which is a bit weird, because ActiveMQDestination.createDestination(name)
> *does* strip off the qualified prefixes.
> Unfortunately I cannot use the ActiveMQDestination.createDestination()
> call
> because my code has to be generic (specifically it has to work with
> WebsphereMQ as well).
> Is this a bug perhaps? Maybe ActiveMQSession.createQueue() shouldn't call
> "new ActiveMQQueue()", but "ActiveMQDestination.createDestination(name,
> 1)"?
> Maarten
> --
> Sent from:
> f2341805.html

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