setting jms property using stop c

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

setting jms property using stop c

vik Dhawan
How can we set jms property (string or other types) using the stop c api.

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: setting jms property using stop c

vik Dhawan
BTW it will help if i explain more :). i am talking about setting and getting the message properties.

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: setting jms property using stop c

James Strachan-2
Which C API? there's a C API in Stomp and there's CMS in ActiveMQ?

On 4/4/06, vik Dhawan <[hidden email]> wrote:

>
> BTW it will help if i explain more :). i am talking about setting and getting
> the message properties.
>
> Thanks!
> --
> View this message in context: http://www.nabble.com/setting-jms-property-using-stop-c-t1394723.html#a3750143
> Sent from the ActiveMQ - Dev forum at Nabble.com.
>
>


--

James
-------
http://radio.weblogs.com/0112098/
Reply | Threaded
Open this post in threaded view
|

Re: setting jms property using stop c

vik Dhawan
I looked at C api in Stomp and didn’t find the way to set property. Then I went ahead and looked in the CMS   implementation for stomp also and not found there either.

thanks!
Reply | Threaded
Open this post in threaded view
|

RE: setting jms property using stop c

Mittler, Nathan
In reply to this post by vik Dhawan
FYI, a new version of CMS is in the works that will be a full
implementation of stomp and will provide the ability to set properties
in the messages - so stay tuned!

If my memory serves me on the stomp c api, you can set properties in the
frame header via an APR.

In their example, they manually set the login as so:

apr_hash_set(frame.headers, "login", APR_HASH_KEY_STRING, "hchirino");

The full example is here:
http://svn.stomp.codehaus.org/trunk/c/src/main.c?view=markup

You should be able to set user-defined properties in this way as well.

Hope this helps,
Nate


-----Original Message-----
From: vik Dhawan [mailto:[hidden email]]
Sent: Wednesday, April 05, 2006 1:56 PM
To: [hidden email]
Subject: Re: setting jms property using stop c


I looked at C api in Stomp and didn't find the way to set property. Then
I
went ahead and looked in the CMS   implementation for stomp also and not
found there either.

thanks!

--
View this message in context:
http://www.nabble.com/setting-jms-property-using-stop-c-t1394723.html#a3
769983
Sent from the ActiveMQ - Dev forum at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

RE: setting jms property using stop c

vik Dhawan
Hey Nate,

Thanks for headsup. I looked into it already and you are correct you can set properties in the header, but according to JMS specs/ Sun Message interface specs (and offcourse the way we implemented OpenWire and Java API), properties should be considered saparate from Header and as the way of Customizing message from the application prepective.

I am not sure if setting header properties using the C stomp client can be retrived with the getProperty call from Java client.

Please let me know when the CMS release will have that feature avaiable, and is there a plan to mofidy frame structure for C stomp implementation which is using apr?

Thanks!

Reply | Threaded
Open this post in threaded view
|

Re: setting jms property using stop c

nmittler
Hi Vik,
Since header properties are the only properties you can set in a STOMP
message, what your question boils down to is what does the ActiveMQ broker
do with those properties - in particular when it forwards those messages to
a Java client.  My guess is that it would simply copy them over to the JMS
message so that you could retrieve them via a call to getProperty().

After a brief look at the code, I found this in org.apache.activemq
/transport.stomp.FrameBuilder

public FrameBuilder addHeaders(ActiveMQMessage message) throws IOException {
        addHeader(Stomp.Headers.Message.DESTINATION,
DestinationNamer.convert(message.getDestination()));
        addHeader(Stomp.Headers.Message.MESSAGE_ID, message.getJMSMessageID());
        addHeader(Stomp.Headers.Message.CORRELATION_ID,
message.getJMSCorrelationID());
        addHeader(Stomp.Headers.Message.EXPIRATION_TIME,
message.getJMSExpiration());
        if (message.getJMSRedelivered()) {
            addHeader(Stomp.Headers.Message.REDELIVERED, "true");
        }
        addHeader(Stomp.Headers.Message.PRORITY, message.getJMSPriority());
        addHeader(Stomp.Headers.Message.REPLY_TO,
DestinationNamer.convert(message.getJMSReplyTo()));
        addHeader(Stomp.Headers.Message.TIMESTAMP, message.getJMSTimestamp());
        addHeader(Stomp.Headers.Message.TYPE, message.getJMSType());

        // now lets add all the message headers
        Map properties = message.getProperties();
        if (properties != null) {
            headers.putAll(properties);
        }
        return this;
    }

So this class creates stomp frames from JMS messages (the opposite direction
for the question you're asking).  But after a quick inspection, it looks
like all JMS properties are transferred to the stomp header.  I would guess
that the reciprocal operation is performed when going from stomp to JMS
messages. If this is true, then the stomp header is the place to stick
everything.  But we should probably get some input from someone on the
ActiveMQ team ... James?

As far as CMS is concerned, it is limited to the stomp protocol, so it would
have to use the header properties map to set properties.

Regards,
Nate

On 4/5/06, vik Dhawan <[hidden email]> wrote:

>
>
> Hey Nate,
>
> Thanks for headsup. I looked into it already and you are correct you can
> set
> properties in the header, but according to JMS specs/ Sun Message
> interface
> specs (and offcourse the way we implemented OpenWire and Java API),
> properties should be considered saparate from Header and as the way of
> Customizing message from the application prepective.
>
> I am not sure if setting header properties using the C stomp client can be
> retrived with the getProperty call from Java client.
>
> Please let me know when the CMS release will have that feature avaiable,
> and
> is there a plan to mofidy frame structure for C stomp implementation which
> is using apr?
>
> Thanks!
>
>
> --
> View this message in context:
> http://www.nabble.com/setting-jms-property-using-stop-c-t1394723.html#a3772510
> Sent from the ActiveMQ - Dev forum at Nabble.com.
>
>