Hi Rajith. Back again sooner than expected :)

My question is how can I create a destination 'dynamically'? meaning that I
need to get my subscription destinations not only statically from the JNDI
properties, but through a destination address that I construct?
Is there any standard practice in qpid that I can follow?

Thanks,
Siamak

On Thu, May 26, 2011 at 4:41 PM, Rajith Attapattu <[email protected]>wrote:

> Your Welcome !
>
> Rajith
>
> On Thu, May 26, 2011 at 4:21 PM, Siamak Kolahi <[email protected]>
> wrote:
> > Thanks Rajith. It works and I am fine now
> >
> > On Thu, May 26, 2011 at 3:29 PM, Rajith Attapattu <[email protected]
> >wrote:
> >
> >> The C++ (python, C#) and JMS clients can recognize text,map and of
> >> course messages with binary content.
> >> If you set the correct content type on the sending end, then the
> >> receiving side will identify the correct message type.
> >>
> >> Have a look at  the MapSender and MapReceiver examples here (JMS).
> >>
> >>
> https://svn.apache.org/repos/asf/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/
> >>
> >> Also have a look at map_sender.cpp and map_receiver.cpp here (C++).
> >>
> https://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/examples/messaging/
> >>
> >> A  C++ receiver should be able to receive a JMS map message
> >> (javax.jms.MapMessage) sent by the jms client and vice versa.
> >> If you have any further questions, please feel free to ask.
> >>
> >> Regards,
> >>
> >> Rajith
> >>
> >> On Thu, May 26, 2011 at 3:10 PM, Siamak Kolahi <[email protected]
> >
> >> wrote:
> >> > Thanks Rajith. It is working fine now. My next question is what is the
> >> best
> >> > way to get the body of the message sent using Messaging APIs in other
> >> > languages? whats the relationship between the structure of the Message
> >> > instance in C++/C#, and the javax.jms.Message class that I am
> receiving?
> >> >
> >> > Currently the message that I receive is of type JMSBytesMessage.
> >> >
> >> > Thanks,
> >> > Siamak
> >> >
> >> > On Wed, May 25, 2011 at 2:26 PM, Rajith Attapattu <[email protected]
> >> >wrote:
> >> >
> >> >> I am very for sending you down a rat hole.
> >> >> The issue here is the double quotes. The address parser treats the
> >> >> entire thing as the queue name hence the exception.
> >> >> Get rid of the double quotes and you should be fine.
> >> >> (I tested this with the 0.8 release just to make sure.)
> >> >>
> >> >> Again I am very sorry for giving the wrong advise about the double
> >> quotes.
> >> >>
> >> >> Rajith
> >> >>
> >> >> On Wed, May 25, 2011 at 1:34 PM, Siamak Kolahi <
> [email protected]
> >> >
> >> >> wrote:
> >> >> > Another attempt to get an input on this problem I am facing. Here
> is
> >> my
> >> >> > destination string:
> >> >> >
> >> >> > destination.header = "beip.subscription; {create:always, delete:
> >> always,
> >> >> > node:{x-bindings:[{exchange:'amq.match', arguments:{x-match:any,
> >> >> > 'userid':10}}]}}"
> >> >> >
> >> >> > and when I am trying to create consumer:
> >> >> >        MessageConsumer messageConsumer =
> >> >> > session.createConsumer(destination);
> >> >> >
> >> >> > I get the following exception:
> >> >> > Caused by: org.apache.qpid.AMQException: The name
> 'beip.subscription;
> >> >> > {create:always, delete: always,
> >> node:{x-bindings:[{exchange:'amq.match',
> >> >> > arguments:{x-match:any, userid:10}}]}}' supplied in the address
> >> doesn't
> >> >> > resolve to an exchange or a queue
> >> >> >    at
> >> >> >
> >> >>
> >>
> org.apache.qpid.client.AMQSession_0_10.handleAddressBasedDestination(AMQSession_0_10.java:1180)
> >> >> >    at
> >> >> >
> >> org.apache.qpid.client.AMQSession.registerConsumer(AMQSession.java:2796)
> >> >> >    at
> >> org.apache.qpid.client.AMQSession.access$500(AMQSession.java:120)
> >> >> >    at
> >> org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:1989)
> >> >> >
> >> >> > I am using 0.8 through JMS and JNDI properties.
> >> >> > Any help/input would be much appreciated. Rajith?
> >> >> >
> >> >> > Thanks,
> >> >> > Siamak
> >> >> >
> >> >> >
> >> >> > On Sun, May 22, 2011 at 12:44 PM, Siamak Kolahi <
> >> [email protected]
> >> >> >wrote:
> >> >> >
> >> >> >> So I am using 0.8 now and parsing is fine. Now I get a different
> >> >> exception
> >> >> >> saying
> >> >> >> "The name 'mysubscription; {create:always, delete: always,
> >> >> >> node:{x-bindings:[{exchange:'
> >> >> >> amq.match', arguments:{'x-match':any, 'userid':10}}]}}' supplied
> in
> >> the
> >> >> >> address doesn't resolve to an exchange or a queue"
> >> >> >>
> >> >> >>
> >> >> >> While I am sure my exchange exists, since its the default header
> >> >> exchange.
> >> >> >> Any idea what I am missing here?
> >> >> >>
> >> >> >> and this is how my property look like:
> >> >> >> destination.header = "subscription; {create:always, delete:
> always,
> >> >> >> node:{x-bindings:[{exchange:'amq.match', arguments:{'x-match':any,
> >> >> >> 'userid':10}}]}}"
> >> >> >>
> >> >> >>
> >> >> >> Thanks,
> >> >> >> Siamak
> >> >> >>
> >> >> >>
> >> >> >> On Fri, May 20, 2011 at 8:31 AM, Rajith Attapattu <
> >> [email protected]
> >> >> >wrote:
> >> >> >>
> >> >> >>> As mentioned 0.6 does not support the new address syntax.
> >> >> >>> From 0.8 on wards support the new address syntax.
> >> >> >>>
> >> >> >>> Make sure you have the correct jar files in the patch.
> >> >> >>> My recommendation is to move to the 0.10 release.
> >> >> >>>
> >> >> >>> Rajith
> >> >> >>>
> >> >> >>> On Thu, May 19, 2011 at 6:08 PM, qpid user 2 <
> [email protected]
> >> >
> >> >> >>> wrote:
> >> >> >>> > I added the double quotes around it and still same error.
> >> >> >>> > Is there any difference in the grammars? I am currently using
> 0.6
> >> and
> >> >> >>> 0.8
> >> >> >>> > and they both give me same error. For some coordination issues
> >> with
> >> >> >>> others
> >> >> >>> > in the team, I cant move on to use 0.10 at this moment :)
> >> >> >>> >
> >> >> >>> >
> >> >> >>> > On Thu, May 19, 2011 at 5:55 PM, Rajith Attapattu <
> >> >> [email protected]
> >> >> >>> >wrote:
> >> >> >>> >
> >> >> >>> >> 1. Two issues. It looks like you have an older version where
> the
> >> >> >>> >> default syntax is Binding URL.
> >> >> >>> >>     So which version are you using? I'd recommend using the
> >> latest
> >> >> >>> >> release (0.10 release).
> >> >> >>> >>
> >> >> >>> >> 2. Once you fix your first problem, then use double quotes
> around
> >> >> your
> >> >> >>> >> address string
> >> >> >>> >>
> >> >> >>> >> destination.header = "my-subscription-queue; {create:always,
> >> >> >>> >> node:{x-declare:{auto-delete:True},
> >> >> >>> >> x-bindings:[{queue:my-subscription-queue,
> exchange:'amq.match',
> >> >> >>> >> arguments:{'x-match':any, 'userid':10}}]}}"
> >> >> >>> >>
> >> >> >>> >> Regards,
> >> >> >>> >>
> >> >> >>> >> Rajith
> >> >> >>> >>
> >> >> >>> >> On Thu, May 19, 2011 at 5:36 PM, qpid user 2 <
> >> [email protected]
> >> >> >
> >> >> >>> >> wrote:
> >> >> >>> >> > Guys. I am using the following destination address in my
> jndi
> >> >> >>> property,
> >> >> >>> >> as
> >> >> >>> >> > advised:
> >> >> >>> >> > destination.header = my-subscription-queue; {create:always,
> >> >> >>> >> > node:{x-declare:{auto-delete:True},
> >> >> >>> >> > x-bindings:[{queue:my-subscription-queue,
> exchange:'amq.match',
> >> >> >>> >> > arguments:{'x-match':any, 'userid':10}}]}}
> >> >> >>> >> >
> >> >> >>> >> > but I am getting a parsing error when parsing for context,
> as
> >> >> >>> follows. Am
> >> >> >>> >> I
> >> >> >>> >> > missing anything?
> >> >> >>> >> >
> >> >> >>> >> >
> >> >> >>> >> > WARNING: Unable to create
> >> destination:java.net.URISyntaxException:
> >> >> >>> Error
> >> >> >>> >> > occured while parsing URL at index 182:
> my-subscription-queue;
> >> >> >>> >> > {create:always, node:{x-declare:{auto-delete:True},
> >> >> >>> >> > x-bindings:[{queue:my-subscription-queue,
> exchange:'amq.match',
> >> >> >>> >> > arguments:{'x-match':any, 'userid':10}}]}}%^
> >> >> >>> >> > java.net.URISyntaxException: Error occured while parsing URL
> at
> >> >> index
> >> >> >>> >> 182:
> >> >> >>> >> > my-subscription-queue; {create:always,
> >> >> >>> >> node:{x-declare:{auto-delete:True},
> >> >> >>> >> > x-bindings:[{queue:my-subscription-queue,
> exchange:'amq.match',
> >> >> >>> >> > arguments:{'x-match':any, 'userid':10}}]}}%^
> >> >> >>> >> >    at
> >> >> >>> >>
> >> >> org.apache.qpid.url.BindingURLParser.<init>(BindingURLParser.java:88)
> >> >> >>> >> >    at
> >> >> >>> >> >
> >> >> >>>
> >> >>
> org.apache.qpid.url.AMQBindingURL.parseBindingURL(AMQBindingURL.java:58)
> >> >> >>> >> >    at
> >> >> org.apache.qpid.url.AMQBindingURL.<init>(AMQBindingURL.java:53)
> >> >> >>> >> >    at
> >> >> >>> >> >
> >> >> >>> >>
> >> >> >>>
> >> >>
> >>
> org.apache.qpid.jndi.PropertiesFileInitialContextFactory.createDestination(PropertiesFileInitialContextFactory.java:241)
> >> >> >>> >> >    at
> >> >> >>> >> >
> >> >> >>> >>
> >> >> >>>
> >> >>
> >>
> org.apache.qpid.jndi.PropertiesFileInitialContextFactory.createDestinations(PropertiesFileInitialContextFactory.java:160)
> >> >> >>> >> >    at
> >> >> >>> >> >
> >> >> >>> >>
> >> >> >>>
> >> >>
> >>
> org.apache.qpid.jndi.PropertiesFileInitialContextFactory.getInitialContext(PropertiesFileInitialContextFactory.java:117)
> >> >> >>> >> >    at
> >> >> >>> >> >
> >> >> >>>
> >> >>
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
> >> >> >>> >> >    at
> >> >> >>> >> >
> >> >> >>>
> >> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
> >> >> >>> >> >    at
> javax.naming.InitialContext.init(InitialContext.java:223)
> >> >> >>> >> >    at
> >> javax.naming.InitialContext.<init>(InitialContext.java:197)
> >> >> >>> >> >    at
> >> >> >>> >> >
> >> >> >>> >>
> >> >> >>>
> >> >>
> >>
> rim.core.instrumentation.subscription.Subscription.main(Subscription.java:37)
> >> >> >>> >> > Caused by: java.lang.ArrayIndexOutOfBoundsException: 182
> >> >> >>> >> >    at
> >> >> >>> >> >
> >> >> >>> >>
> >> >> >>>
> >> >>
> >>
> org.apache.qpid.url.BindingURLParser.extractExchangeName(BindingURLParser.java:218)
> >> >> >>> >> >    at
> >> >> >>> >>
> >> org.apache.qpid.url.BindingURLParser.next(BindingURLParser.java:137)
> >> >> >>> >> >    at
> >> >> >>> >>
> >> >> org.apache.qpid.url.BindingURLParser.<init>(BindingURLParser.java:70)
> >> >> >>> >> >    ... 10 more
> >> >> >>> >> >
> >> >> >>> >> >
> >> >> >>> >> > Thanks
> >> >> >>> >> > Siamak
> >> >> >>> >> >
> >> >> >>> >> >
> >> >> >>> >> >
> >> >> >>> >> > On Thu, May 19, 2011 at 10:55 AM, Gordon Sim <
> [email protected]>
> >> >> >>> wrote:
> >> >> >>> >> >
> >> >> >>> >> >> On 05/19/2011 03:53 PM, Rajith Attapattu wrote:
> >> >> >>> >> >>
> >> >> >>> >> >>> On Thu, May 19, 2011 at 10:04 AM, Gordon Sim<
> [email protected]
> >> >
> >> >> >>>  wrote:
> >> >> >>> >> >>>
> >> >> >>> >> >>>> On 05/19/2011 02:36 PM, qpid user 2 wrote:
> >> >> >>> >> >>>>
> >> >> >>> >> >>>>>
> >> >> >>> >> >>>>> So any input on this? I am trying to construct a header
> >> >> exchange
> >> >> >>> >> >>>>> subscription using JMS. How would the destination and
> jndi
> >> >> >>> properties
> >> >> >>> >> >>>>> look
> >> >> >>> >> >>>>> like?
> >> >> >>> >> >>>>>
> >> >> >>> >> >>>>
> >> >> >>> >> >>>> For python or c++ the following address is an example of
> >> what
> >> >> you
> >> >> >>> >> want:
> >> >> >>> >> >>>>
> >> >> >>> >> >>>>  my-headers-exchange;
> >> >> >>> >> >>>> {link:{x-bindings:[{arguments:{'x-match':all,a:b,c:d}}]}}
> >> >> >>> >> >>>>
> >> >> >>> >> >>>> That is assuming you have created the headers exchange
> named
> >> >> >>> >> >>>> my-headers-exchange already, e.g. with qpid-config. This
> >> will
> >> >> >>> match
> >> >> >>> >> any
> >> >> >>> >> >>>> message with both a header keyed 'a' with value 'b' and a
> >> >> header
> >> >> >>> keyed
> >> >> >>> >> >>>> 'c'
> >> >> >>> >> >>>> with value 'd'.
> >> >> >>> >> >>>>
> >> >> >>> >> >>>> Unfortunately it would appear there is a bug in the JMS
> >> client
> >> >> >>> >> preventing
> >> >> >>> >> >>>> this from working there. (
> >> >> >>> >> >>>> https://issues.apache.org/jira/browse/QPID-3265)
> >> >> >>> >> >>>>
> >> >> >>> >> >>>> An alternative address would be:
> >> >> >>> >> >>>>
> >> >> >>> >> >>>>  my-subscription-queue; {create:always,
> >> >> >>> >> >>>> node:{x-declare:{auto-delete:True},
> >> >> >>> >> >>>> x-bindings:[{queue:my-subscription-queue,
> >> >> >>> >> exchange:my-headers-exchange,
> >> >> >>> >> >>>> arguments:{'x-match':all,a:b,c:d}}]}}
> >> >> >>> >> >>>>
> >> >> >>> >> >>>> However that requires that my-subscription-queue be a
> unique
> >> >> name
> >> >> >>> -
> >> >> >>> >> not
> >> >> >>> >> >>>> sure
> >> >> >>> >> >>>> how well that will work for a JNDI based destination.
> >> >> >>> >> >>>>
> >> >> >>> >> >>>
> >> >> >>> >> >>> I verified that the above addressing string can be
> specified
> >> in
> >> >> the
> >> >> >>> >> >>> JNDI properties.
> >> >> >>> >> >>>
> >> >> >>> >> >>
> >> >> >>> >> >> The point is not that it can't be specified in JNDI but
> that
> >> >> >>> multiple
> >> >> >>> >> >> consumers created from the destination obtained will all be
> >> using
> >> >> >>> the
> >> >> >>> >> same
> >> >> >>> >> >> queue and will thus compete for messages which is not what
> you
> >> >> want.
> >> >> >>> >> >>
> >> >> >>> >> >> If there was only going to be one consumer that might not
> be
> >> an
> >> >> >>> issue of
> >> >> >>> >> >> course.
> >> >> >>> >> >>
> >> >> >>> >> >>
> >> >> >>> >> >>
> >> >> >>>
> >> ---------------------------------------------------------------------
> >> >> >>> >> >> Apache Qpid - AMQP Messaging Implementation
> >> >> >>> >> >> Project:      http://qpid.apache.org
> >> >> >>> >> >> Use/Interact: mailto:[email protected]
> >> >> >>> >> >>
> >> >> >>> >> >>
> >> >> >>> >> >
> >> >> >>> >>
> >> >> >>> >>
> >> >> ---------------------------------------------------------------------
> >> >> >>> >> Apache Qpid - AMQP Messaging Implementation
> >> >> >>> >> Project:      http://qpid.apache.org
> >> >> >>> >> Use/Interact: mailto:[email protected]
> >> >> >>> >>
> >> >> >>> >>
> >> >> >>> >
> >> >> >>>
> >> >> >>>
> >> ---------------------------------------------------------------------
> >> >> >>> Apache Qpid - AMQP Messaging Implementation
> >> >> >>> Project:      http://qpid.apache.org
> >> >> >>> Use/Interact: mailto:[email protected]
> >> >> >>>
> >> >> >>>
> >> >> >>
> >> >> >
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> Apache Qpid - AMQP Messaging Implementation
> >> >> Project:      http://qpid.apache.org
> >> >> Use/Interact: mailto:[email protected]
> >> >>
> >> >>
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> Apache Qpid - AMQP Messaging Implementation
> >> Project:      http://qpid.apache.org
> >> Use/Interact: mailto:[email protected]
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:[email protected]
>
>

Reply via email to