You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Joshua Smith <jo...@rationalpi.com> on 2008/07/07 03:44:05 UTC

ObjectMessage in C/C++

ActiveMQ Users-

I have a project coming up where we'll be using ActiveMQ as our JMS server
between a Java application and a C/C++ application. I'd like to exchange
ObjectMessages. Is there anything special (e.g. endian) that I need to be
aware of? Does the C/C++ application have to have objects defined that are
the equivalent of my Java objects?


Thanks,
Joshua Smith

Re: ObjectMessage in C/C++

Posted by Joshua Smith <jo...@rationalpi.com>.
Thanks again Nathan. I'll give those references a look.

Joshua Smith

On 7/7/08, Nathan Mittler <na...@gmail.com> wrote:
>
> Joshua,
> The C++ application wouldn't consume a JMS ObjectMessage; rather, it would
> have the message transformed to something it can consume, say XML.  This
> transformation process is where Apache Camel comes in.  The ActiveMQ 5.x
> broker can embed Camel components that will allow you to define a custom
> transformer that receives on one messaging channel, transforms the message,
> and then sends out the new message to your C++ application on another
> channel.
>
> This link shows the basics for configuring Camel in your ActiveMQ broker:
> http://activemq.apache.org/enterprise-integration-patterns.html
>
> And this should help you get started with Camel:
> http://activemq.apache.org/camel/getting-started.html
>
> Regards,
> Nate
>
> On Jul 6, 2008, at 8:53 PM, Joshua Smith wrote:
>
>  Thanks Nathan. I went and looked at the link. Could you describe how this
>> works a little more? Is the C++ program doing something different or am I
>> configuring ActiveMQ to do something different when the client is a C++
>> application? How does Camel fit into the picture?
>>
>> Thanks,
>> Joshua Smith
>>
>>

Re: ObjectMessage in C/C++

Posted by Nathan Mittler <na...@gmail.com>.
Joshua,
The C++ application wouldn't consume a JMS ObjectMessage; rather, it  
would have the message transformed to something it can consume, say  
XML.  This transformation process is where Apache Camel comes in.  The  
ActiveMQ 5.x broker can embed Camel components that will allow you to  
define a custom transformer that receives on one messaging channel,  
transforms the message, and then sends out the new message to your C++  
application on another channel.

This link shows the basics for configuring Camel in your ActiveMQ  
broker: http://activemq.apache.org/enterprise-integration-patterns.html

And this should help you get started with Camel: http://activemq.apache.org/camel/getting-started.html

Regards,
Nate

On Jul 6, 2008, at 8:53 PM, Joshua Smith wrote:

> Thanks Nathan. I went and looked at the link. Could you describe how  
> this
> works a little more? Is the C++ program doing something different or  
> am I
> configuring ActiveMQ to do something different when the client is a C 
> ++
> application? How does Camel fit into the picture?
>
> Thanks,
> Joshua Smith
>

Re: ObjectMessage in C/C++

Posted by Joshua Smith <jo...@rationalpi.com>.
Thanks Nathan. I went and looked at the link. Could you describe how this
works a little more? Is the C++ program doing something different or am I
configuring ActiveMQ to do something different when the client is a C++
application? How does Camel fit into the picture?

Thanks,
Joshua Smith

On 7/6/08, Nathan Mittler <na...@gmail.com> wrote:
>
> ActiveMQ-CPP doesn't support ObjectMessages.  If you're stuck sending
> ObjectMessages from Java, probably your best bet would be to use a Camel
> message translator in the broker (
> http://activemq.apache.org/camel/message-translator.html).
>
> Regards,
> Nate
>
> On Jul 6, 2008, at 6:44 PM, Joshua Smith wrote:
>
>  ActiveMQ Users-
>>
>> I have a project coming up where we'll be using ActiveMQ as our JMS server
>> between a Java application and a C/C++ application. I'd like to exchange
>> ObjectMessages. Is there anything special (e.g. endian) that I need to be
>> aware of? Does the C/C++ application have to have objects defined that are
>> the equivalent of my Java objects?
>>
>>
>> Thanks,
>> Joshua Smith
>>
>
>

Re: ObjectMessage in C/C++

Posted by thinkbox <pa...@yahoo.com>.
I see..
Thanks a lot Tim!


Timothy Bish wrote:
> 
> On Thu, 2009-11-05 at 22:57 -0800, thinkbox wrote:
>> I see, that makes sense, I get the point.
>> Thanks Tim!
>> 
>> - Pat
>> 
>> X.S. Just a side comment. Having said that ActiveMQ C++ cannot support
>> ObjectMessage -- can we assume that ObjectMessage is reserved for future
>> use? Or are we looking at the CMS version of ObjectMessage the same is it
>> is
>> implemented now?
>> 
> 
> The ObjectMessage type in CMS is simply a placeholder which allows us to
> return your client an ObjectMessage instnace when that type of message
> is received instead of crashing or silently throwing out the message.
> This allows you to at least access the the Message Properties and know
> that it was received.
> 
> Regards
> Tim.
> 
>> 
>> 
>> Timothy Bish wrote:
>> > 
>> > On Wed, 2009-11-04 at 19:20 -0800, thinkbox wrote:
>> >> Hi Nate, I am also in the same situation with Joshua and is currently
>> >> considering ActiveMQ-CPP for my C++ clients to be able to talk to my
>> Java
>> >> components. I am currently using version 2.2.6 of ActiveMQ-CPP, are
>> there
>> >> any updates if ObjectMessages is now supported?
>> >> 
>> > 
>> > ActiveMQ C++ cannot support ObjectMessage.  The serialized version of a
>> > Java object is not readable by the C++ code, and can't be converted
>> into
>> > a C++ type.  You need to perform some sort of transformation on the
>> > Object before sending to a C++ client, such as converting it to XML and
>> > sending it as a TextMessage, then your C++ code can turn it back into a
>> > C++ object of your own design or just parse the XML for the data you
>> are
>> > after.  A search for C++ XML Binding on Google will give you some
>> > insights into how to accomplish that.  
>> > 
>> >> Also, say my serialized object is implemented below,
>> >> 
>> >> public class Subscriber implements Serializable {
>> >>     private String name;
>> >>     private int age;
>> >>     
>> >>     ...
>> >> 
>> >>     //setters and getters method follows
>> >> }
>> >> 
>> >> 
>> >> On my C++ code, say I have created an equivalent Subscriber class,
>> can't
>> >> I
>> >> just cast the returned object of getObject() into Subscriber?
>> >> 
>> >> Thanks,
>> >> Pat
>> >> 
>> >> 
>> >> nmittler wrote:
>> >> > 
>> >> > ActiveMQ-CPP doesn't support ObjectMessages.  If you're stuck
>> sending  
>> >> > ObjectMessages from Java, probably your best bet would be to use a  
>> >> > Camel message translator in the broker
>> >> > (http://activemq.apache.org/camel/message-translator.html 
>> >> > ).
>> >> > 
>> >> > Regards,
>> >> > Nate
>> >> > 
>> >> > On Jul 6, 2008, at 6:44 PM, Joshua Smith wrote:
>> >> > 
>> >> >> ActiveMQ Users-
>> >> >>
>> >> >> I have a project coming up where we'll be using ActiveMQ as our JMS  
>> >> >> server
>> >> >> between a Java application and a C/C++ application. I'd like to  
>> >> >> exchange
>> >> >> ObjectMessages. Is there anything special (e.g. endian) that I need  
>> >> >> to be
>> >> >> aware of? Does the C/C++ application have to have objects defined  
>> >> >> that are
>> >> >> the equivalent of my Java objects?
>> >> >>
>> >> >>
>> >> >> Thanks,
>> >> >> Joshua Smith
>> >> > 
>> >> > 
>> >> > 
>> >> 
>> > -- 
>> > Tim Bish
>> > http://fusesource.com
>> > http://timbish.blogspot.com/
>> > 
>> > 
>> > 
>> > 
>> > 
>> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/ObjectMessage-in-C-C%2B%2B-tp18308791p26260417.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: ObjectMessage in C/C++

Posted by Timothy Bish <ta...@gmail.com>.
On Thu, 2009-11-05 at 22:57 -0800, thinkbox wrote:
> I see, that makes sense, I get the point.
> Thanks Tim!
> 
> - Pat
> 
> X.S. Just a side comment. Having said that ActiveMQ C++ cannot support
> ObjectMessage -- can we assume that ObjectMessage is reserved for future
> use? Or are we looking at the CMS version of ObjectMessage the same is it is
> implemented now?
> 

The ObjectMessage type in CMS is simply a placeholder which allows us to
return your client an ObjectMessage instnace when that type of message
is received instead of crashing or silently throwing out the message.
This allows you to at least access the the Message Properties and know
that it was received.

Regards
Tim.

> 
> 
> Timothy Bish wrote:
> > 
> > On Wed, 2009-11-04 at 19:20 -0800, thinkbox wrote:
> >> Hi Nate, I am also in the same situation with Joshua and is currently
> >> considering ActiveMQ-CPP for my C++ clients to be able to talk to my Java
> >> components. I am currently using version 2.2.6 of ActiveMQ-CPP, are there
> >> any updates if ObjectMessages is now supported?
> >> 
> > 
> > ActiveMQ C++ cannot support ObjectMessage.  The serialized version of a
> > Java object is not readable by the C++ code, and can't be converted into
> > a C++ type.  You need to perform some sort of transformation on the
> > Object before sending to a C++ client, such as converting it to XML and
> > sending it as a TextMessage, then your C++ code can turn it back into a
> > C++ object of your own design or just parse the XML for the data you are
> > after.  A search for C++ XML Binding on Google will give you some
> > insights into how to accomplish that.  
> > 
> >> Also, say my serialized object is implemented below,
> >> 
> >> public class Subscriber implements Serializable {
> >>     private String name;
> >>     private int age;
> >>     
> >>     ...
> >> 
> >>     //setters and getters method follows
> >> }
> >> 
> >> 
> >> On my C++ code, say I have created an equivalent Subscriber class, can't
> >> I
> >> just cast the returned object of getObject() into Subscriber?
> >> 
> >> Thanks,
> >> Pat
> >> 
> >> 
> >> nmittler wrote:
> >> > 
> >> > ActiveMQ-CPP doesn't support ObjectMessages.  If you're stuck sending  
> >> > ObjectMessages from Java, probably your best bet would be to use a  
> >> > Camel message translator in the broker
> >> > (http://activemq.apache.org/camel/message-translator.html 
> >> > ).
> >> > 
> >> > Regards,
> >> > Nate
> >> > 
> >> > On Jul 6, 2008, at 6:44 PM, Joshua Smith wrote:
> >> > 
> >> >> ActiveMQ Users-
> >> >>
> >> >> I have a project coming up where we'll be using ActiveMQ as our JMS  
> >> >> server
> >> >> between a Java application and a C/C++ application. I'd like to  
> >> >> exchange
> >> >> ObjectMessages. Is there anything special (e.g. endian) that I need  
> >> >> to be
> >> >> aware of? Does the C/C++ application have to have objects defined  
> >> >> that are
> >> >> the equivalent of my Java objects?
> >> >>
> >> >>
> >> >> Thanks,
> >> >> Joshua Smith
> >> > 
> >> > 
> >> > 
> >> 
> > -- 
> > Tim Bish
> > http://fusesource.com
> > http://timbish.blogspot.com/
> > 
> > 
> > 
> > 
> > 
> 


Re: ObjectMessage in C/C++

Posted by thinkbox <pa...@yahoo.com>.
I see, that makes sense, I get the point.
Thanks Tim!

- Pat

X.S. Just a side comment. Having said that ActiveMQ C++ cannot support
ObjectMessage -- can we assume that ObjectMessage is reserved for future
use? Or are we looking at the CMS version of ObjectMessage the same is it is
implemented now?



Timothy Bish wrote:
> 
> On Wed, 2009-11-04 at 19:20 -0800, thinkbox wrote:
>> Hi Nate, I am also in the same situation with Joshua and is currently
>> considering ActiveMQ-CPP for my C++ clients to be able to talk to my Java
>> components. I am currently using version 2.2.6 of ActiveMQ-CPP, are there
>> any updates if ObjectMessages is now supported?
>> 
> 
> ActiveMQ C++ cannot support ObjectMessage.  The serialized version of a
> Java object is not readable by the C++ code, and can't be converted into
> a C++ type.  You need to perform some sort of transformation on the
> Object before sending to a C++ client, such as converting it to XML and
> sending it as a TextMessage, then your C++ code can turn it back into a
> C++ object of your own design or just parse the XML for the data you are
> after.  A search for C++ XML Binding on Google will give you some
> insights into how to accomplish that.  
> 
>> Also, say my serialized object is implemented below,
>> 
>> public class Subscriber implements Serializable {
>>     private String name;
>>     private int age;
>>     
>>     ...
>> 
>>     //setters and getters method follows
>> }
>> 
>> 
>> On my C++ code, say I have created an equivalent Subscriber class, can't
>> I
>> just cast the returned object of getObject() into Subscriber?
>> 
>> Thanks,
>> Pat
>> 
>> 
>> nmittler wrote:
>> > 
>> > ActiveMQ-CPP doesn't support ObjectMessages.  If you're stuck sending  
>> > ObjectMessages from Java, probably your best bet would be to use a  
>> > Camel message translator in the broker
>> > (http://activemq.apache.org/camel/message-translator.html 
>> > ).
>> > 
>> > Regards,
>> > Nate
>> > 
>> > On Jul 6, 2008, at 6:44 PM, Joshua Smith wrote:
>> > 
>> >> ActiveMQ Users-
>> >>
>> >> I have a project coming up where we'll be using ActiveMQ as our JMS  
>> >> server
>> >> between a Java application and a C/C++ application. I'd like to  
>> >> exchange
>> >> ObjectMessages. Is there anything special (e.g. endian) that I need  
>> >> to be
>> >> aware of? Does the C/C++ application have to have objects defined  
>> >> that are
>> >> the equivalent of my Java objects?
>> >>
>> >>
>> >> Thanks,
>> >> Joshua Smith
>> > 
>> > 
>> > 
>> 
> -- 
> Tim Bish
> http://fusesource.com
> http://timbish.blogspot.com/
> 
> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/ObjectMessage-in-C-C%2B%2B-tp18308791p26227608.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: ObjectMessage in C/C++

Posted by Timothy Bish <ta...@gmail.com>.
On Wed, 2009-11-04 at 19:20 -0800, thinkbox wrote:
> Hi Nate, I am also in the same situation with Joshua and is currently
> considering ActiveMQ-CPP for my C++ clients to be able to talk to my Java
> components. I am currently using version 2.2.6 of ActiveMQ-CPP, are there
> any updates if ObjectMessages is now supported?
> 

ActiveMQ C++ cannot support ObjectMessage.  The serialized version of a
Java object is not readable by the C++ code, and can't be converted into
a C++ type.  You need to perform some sort of transformation on the
Object before sending to a C++ client, such as converting it to XML and
sending it as a TextMessage, then your C++ code can turn it back into a
C++ object of your own design or just parse the XML for the data you are
after.  A search for C++ XML Binding on Google will give you some
insights into how to accomplish that.  

> Also, say my serialized object is implemented below,
> 
> public class Subscriber implements Serializable {
>     private String name;
>     private int age;
>     
>     ...
> 
>     //setters and getters method follows
> }
> 
> 
> On my C++ code, say I have created an equivalent Subscriber class, can't I
> just cast the returned object of getObject() into Subscriber?
> 
> Thanks,
> Pat
> 
> 
> nmittler wrote:
> > 
> > ActiveMQ-CPP doesn't support ObjectMessages.  If you're stuck sending  
> > ObjectMessages from Java, probably your best bet would be to use a  
> > Camel message translator in the broker
> > (http://activemq.apache.org/camel/message-translator.html 
> > ).
> > 
> > Regards,
> > Nate
> > 
> > On Jul 6, 2008, at 6:44 PM, Joshua Smith wrote:
> > 
> >> ActiveMQ Users-
> >>
> >> I have a project coming up where we'll be using ActiveMQ as our JMS  
> >> server
> >> between a Java application and a C/C++ application. I'd like to  
> >> exchange
> >> ObjectMessages. Is there anything special (e.g. endian) that I need  
> >> to be
> >> aware of? Does the C/C++ application have to have objects defined  
> >> that are
> >> the equivalent of my Java objects?
> >>
> >>
> >> Thanks,
> >> Joshua Smith
> > 
> > 
> > 
> 
-- 
Tim Bish
http://fusesource.com
http://timbish.blogspot.com/




Re: ObjectMessage in C/C++

Posted by thinkbox <pa...@yahoo.com>.
Hi Nate, I am also in the same situation with Joshua and is currently
considering ActiveMQ-CPP for my C++ clients to be able to talk to my Java
components. I am currently using version 2.2.6 of ActiveMQ-CPP, are there
any updates if ObjectMessages is now supported?

Also, say my serialized object is implemented below,

public class Subscriber implements Serializable {
    private String name;
    private int age;
    
    ...

    //setters and getters method follows
}


On my C++ code, say I have created an equivalent Subscriber class, can't I
just cast the returned object of getObject() into Subscriber?

Thanks,
Pat


nmittler wrote:
> 
> ActiveMQ-CPP doesn't support ObjectMessages.  If you're stuck sending  
> ObjectMessages from Java, probably your best bet would be to use a  
> Camel message translator in the broker
> (http://activemq.apache.org/camel/message-translator.html 
> ).
> 
> Regards,
> Nate
> 
> On Jul 6, 2008, at 6:44 PM, Joshua Smith wrote:
> 
>> ActiveMQ Users-
>>
>> I have a project coming up where we'll be using ActiveMQ as our JMS  
>> server
>> between a Java application and a C/C++ application. I'd like to  
>> exchange
>> ObjectMessages. Is there anything special (e.g. endian) that I need  
>> to be
>> aware of? Does the C/C++ application have to have objects defined  
>> that are
>> the equivalent of my Java objects?
>>
>>
>> Thanks,
>> Joshua Smith
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/ObjectMessage-in-C-C%2B%2B-tp18308791p26208362.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: ObjectMessage in C/C++

Posted by Nathan Mittler <na...@gmail.com>.
ActiveMQ-CPP doesn't support ObjectMessages.  If you're stuck sending  
ObjectMessages from Java, probably your best bet would be to use a  
Camel message translator in the broker (http://activemq.apache.org/camel/message-translator.html 
).

Regards,
Nate

On Jul 6, 2008, at 6:44 PM, Joshua Smith wrote:

> ActiveMQ Users-
>
> I have a project coming up where we'll be using ActiveMQ as our JMS  
> server
> between a Java application and a C/C++ application. I'd like to  
> exchange
> ObjectMessages. Is there anything special (e.g. endian) that I need  
> to be
> aware of? Does the C/C++ application have to have objects defined  
> that are
> the equivalent of my Java objects?
>
>
> Thanks,
> Joshua Smith