You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by alexvs <th...@gmail.com> on 2007/06/06 19:53:57 UTC

Integrating C++ Client with MDB

Hi guys,

I need help!  I have two extra days to finish this project and I can't
figure out how to make my C++ client send messages to ActiveMQ and have
these messages delivered to my MDB.  I have the example running in C++, but
I don't know how to locate the JMS topic or connection that would route to
my MDB.

Any help would be greatly appreciated!

Thanks.
-- 
View this message in context: http://www.nabble.com/Integrating-C%2B%2B-Client-with-MDB-tf3879413s2354.html#a10993863
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


RE: Integrating C++ Client with MDB

Posted by alexvs <th...@gmail.com>.
Yes, I have.

datanga wrote:
> 
> Hello,
> 
>> destination = session->createTopic( "TOPIC.SciTegic" ); // IS THIS THE 
>> RIGHT NAME TO USE?
> 
> Have you tried to this?
> 
> destination = session->createTopic( "topic/SciTegic" ); 
> 
> Cheers,
> 
> Desire
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Integrating-C%2B%2B-Client-with-MDB-tf3879413s2354.html#a11010678
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Integrating C++ Client with MDB

Posted by Nathan Mittler <na...@gmail.com>.
BTW, have you tried making a Java client that does not use JNDI?  You should
have the same result as using the C++ client.  Perhaps you could simplify
your problem by cooking up a simple Java client and eliminating C++
altogether.

On 6/7/07, Nathan Mittler <na...@gmail.com> wrote:
>
> That would be my guess (use "topic/SciTegic") ... the problem of creating
> topics vs using pre-existing ones should not be a non-issue.  All
> topics/queues in ActiveMQ are dynamic, so it doesn't matter how you create
> them (from the client-side or server-side).  So long as the names are the
> same, it should work.
>
> On 6/7/07, Desire ATANGA <da...@octo.com> wrote:
> >
> > Hello,
> >
> > > destination = session->createTopic( "TOPIC.SciTegic" ); // IS THIS THE
> > > RIGHT NAME TO USE?
> >
> > Have you tried to this?
> >
> > destination = session->createTopic( "topic/SciTegic" );
> >
> > Cheers,
> >
> > Desire
> >
> >
>

Re: Integrating C++ Client with MDB

Posted by emcee21 <mi...@gmail.com>.

Tim Bish wrote:
> 
> Creating a Java client to test with might help you rule out the if its 
> the MDB or the C++ code that is faulty.  Its just another Data Point to 
> try and help figure out what's wrong.
> 

I had a similar problem, using the Java client but it could easily be the
same issue.  I had followed the step-by-step instructions to integrate
ActiveMQ with JBoss using the in-VM communication, and wound up with two
separate brokers, one with the name I chose in "broker-config.xml" and one
named "localhost".  When I switched from in-VM to tcp communcation, my MDB
received the messages generated by the native client.


-- 
View this message in context: http://www.nabble.com/Integrating-C%2B%2B-Client-with-MDB-tf3879413s2354.html#a11291508
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Integrating C++ Client with MDB

Posted by Timothy Bish <ta...@twcny.rr.com>.
Creating a Java client to test with might help you rule out the if its 
the MDB or the C++ code that is faulty.  Its just another Data Point to 
try and help figure out what's wrong.

alexvs wrote:
> That's what I tried first, but "topic/SciTegic", according to jboss is the
> jndi name of the topic.  The actual topic name is SciTegic, but maybe
> something else has to be appended to the name, I have no clue.
>
> This is for a huge C++ application we're trying to integrate with an APP
> server, so, unfortunately having a java client is not an option at this
> point.
>
>
> nmittler wrote:
>   
>> That would be my guess (use "topic/SciTegic") ... the problem of creating
>> topics vs using pre-existing ones should not be a non-issue.  All
>> topics/queues in ActiveMQ are dynamic, so it doesn't matter how you create
>> them (from the client-side or server-side).  So long as the names are the
>> same, it should work.
>>
>> On 6/7/07, Desire ATANGA <da...@octo.com> wrote:
>>     
>>> Hello,
>>>
>>>       
>>>> destination = session->createTopic( "TOPIC.SciTegic" ); // IS THIS THE
>>>> RIGHT NAME TO USE?
>>>>         
>>> Have you tried to this?
>>>
>>> destination = session->createTopic( "topic/SciTegic" );
>>>
>>> Cheers,
>>>
>>> Desire
>>>
>>>
>>>       
>>     
>
>   


Re: Integrating C++ Client with MDB

Posted by alexvs <th...@gmail.com>.
That's what I tried first, but "topic/SciTegic", according to jboss is the
jndi name of the topic.  The actual topic name is SciTegic, but maybe
something else has to be appended to the name, I have no clue.

This is for a huge C++ application we're trying to integrate with an APP
server, so, unfortunately having a java client is not an option at this
point.


nmittler wrote:
> 
> That would be my guess (use "topic/SciTegic") ... the problem of creating
> topics vs using pre-existing ones should not be a non-issue.  All
> topics/queues in ActiveMQ are dynamic, so it doesn't matter how you create
> them (from the client-side or server-side).  So long as the names are the
> same, it should work.
> 
> On 6/7/07, Desire ATANGA <da...@octo.com> wrote:
>>
>> Hello,
>>
>> > destination = session->createTopic( "TOPIC.SciTegic" ); // IS THIS THE
>> > RIGHT NAME TO USE?
>>
>> Have you tried to this?
>>
>> destination = session->createTopic( "topic/SciTegic" );
>>
>> Cheers,
>>
>> Desire
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Integrating-C%2B%2B-Client-with-MDB-tf3879413s2354.html#a11010766
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Integrating C++ Client with MDB

Posted by Nathan Mittler <na...@gmail.com>.
That would be my guess (use "topic/SciTegic") ... the problem of creating
topics vs using pre-existing ones should not be a non-issue.  All
topics/queues in ActiveMQ are dynamic, so it doesn't matter how you create
them (from the client-side or server-side).  So long as the names are the
same, it should work.

On 6/7/07, Desire ATANGA <da...@octo.com> wrote:
>
> Hello,
>
> > destination = session->createTopic( "TOPIC.SciTegic" ); // IS THIS THE
> > RIGHT NAME TO USE?
>
> Have you tried to this?
>
> destination = session->createTopic( "topic/SciTegic" );
>
> Cheers,
>
> Desire
>
>

RE: Integrating C++ Client with MDB

Posted by Desire ATANGA <da...@octo.com>.
Hello,

> destination = session->createTopic( "TOPIC.SciTegic" ); // IS THIS THE 
> RIGHT NAME TO USE?

Have you tried to this?

destination = session->createTopic( "topic/SciTegic" ); 

Cheers,

Desire


Re: Integrating C++ Client with MDB

Posted by alexvs <th...@gmail.com>.
Hi Albert

Same here; I see it listed on jboss JMX console as well.  If C++ calls with
a topic name of TEST.FOO, that topic is added to the list.  However, nothing
happens when I use the exact same destination name as the one my MDB is
listening to.  In a sense I am not "creating" a topic, I am merely looking
one up and I was wondering if that createTopic method from C++ is really the
way to go on this case.

Have you been able to call your MDB from C++?

I am at a loss here.  This was for a prototype project and since I can't get
this to work we'll probably have to stick with C++ for the server
environment, which I was trying to avoid at all costs.

If you can think of anything else, pleaset let me nknow.

Thank you for your help!

Albert Strasheim wrote:
> 
> Hello
> 
> You could try using JMX to look at the queues and topics on the broker. 
> Maybe JNDI is adding something to name, as you said.
> 
> If I pass the string "foo" to Session::createTopic, I end up with a 
> topic called "foo" which I can see in JMX.
> 
> Cheers,
> 
> Albert
> 
> 

-- 
View this message in context: http://www.nabble.com/Integrating-C%2B%2B-Client-with-MDB-tf3879413s2354.html#a10998238
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Integrating C++ Client with MDB

Posted by Albert Strasheim <13...@sun.ac.za>.
Hello

You could try using JMX to look at the queues and topics on the broker. 
Maybe JNDI is adding something to name, as you said.

If I pass the string "foo" to Session::createTopic, I end up with a 
topic called "foo" which I can see in JMX.

Cheers,

Albert

Re: Integrating C++ Client with MDB

Posted by alexvs <th...@gmail.com>.
Hi Albert - Yes, I have.  No luck.


Albert Strasheim wrote:
> 
> Hello
> 
> On Wed, 06 Jun 2007, alexvs wrote:
> 
>> I am just trying to replicate what's bound to Java's JNDI. 
>> (java:topic/SciTegic).  Also when I output the message to the console
>> from
>> the MDB, I get this:
>> 
>> 3:37:45,280 INFO  [STDOUT] onMessage() - SpyTextMessage {
>> Header { 
>>    jmsDestination  : TOPIC.SciTegic
> 
>> So the destination seems to be called TOPIC.SciTegic? Am I wrong?
> 
> Yes, but the topic is called SciTegic. Have you tried it without TOPIC.? 
> Worst case, it doesn't work.
> 
> Cheers,
> 
> Albert
> 
> 

-- 
View this message in context: http://www.nabble.com/Integrating-C%2B%2B-Client-with-MDB-tf3879413s2354.html#a10996901
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Integrating C++ Client with MDB

Posted by Albert Strasheim <13...@sun.ac.za>.
Hello

On Wed, 06 Jun 2007, alexvs wrote:

> I am just trying to replicate what's bound to Java's JNDI. 
> (java:topic/SciTegic).  Also when I output the message to the console from
> the MDB, I get this:
> 
> 3:37:45,280 INFO  [STDOUT] onMessage() - SpyTextMessage {
> Header { 
>    jmsDestination  : TOPIC.SciTegic

> So the destination seems to be called TOPIC.SciTegic? Am I wrong?

Yes, but the topic is called SciTegic. Have you tried it without TOPIC.? 
Worst case, it doesn't work.

Cheers,

Albert

Re: Integrating C++ Client with MDB

Posted by alexvs <th...@gmail.com>.
I am just trying to replicate what's bound to Java's JNDI. 
(java:topic/SciTegic).  Also when I output the message to the console from
the MDB, I get this:

3:37:45,280 INFO  [STDOUT] onMessage() - SpyTextMessage {
Header { 
   jmsDestination  : TOPIC.SciTegic
   jmsDeliveryMode : 2
   jmsExpiration   : 0
   jmsPriority     : 4
   jmsMessageID    : ID:7-11810758652651
   jmsTimeStamp    : 1181075865265
   jmsCorrelationID: null
   jmsReplyTo      : null
   jmsType         : null
   jmsRedelivered  : false
   jmsProperties   : {}
   jmsPropReadWrite: false
   msgReadOnly     : true
   producerClientId: ID:7
}
Body {
   text            :TEST MESSAGE FOR MDB
}
}

So the destination seems to be called TOPIC.SciTegic? Am I wrong?


Albert Strasheim wrote:
> 
> On Wed, 06 Jun 2007, alexvs wrote:
> 
>> destination = session->createTopic( "TOPIC.SciTegic" ); // IS THIS THE
>> RIGHT
>> NAME TO USE? 
> 
> I think you just want "SciTegic". Do you know of any documentation that 
> would indicate that you should prepend "TOPIC." ?
> 
> Cheers,
> 
> Albert
> 
> 

-- 
View this message in context: http://www.nabble.com/Integrating-C%2B%2B-Client-with-MDB-tf3879413s2354.html#a10995796
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Integrating C++ Client with MDB

Posted by Albert Strasheim <13...@sun.ac.za>.
On Wed, 06 Jun 2007, alexvs wrote:

> destination = session->createTopic( "TOPIC.SciTegic" ); // IS THIS THE RIGHT
> NAME TO USE? 

I think you just want "SciTegic". Do you know of any documentation that 
would indicate that you should prepend "TOPIC." ?

Cheers,

Albert

Re: Integrating C++ Client with MDB

Posted by alexvs <th...@gmail.com>.
Thank you for your reply!  Here is what I have on the Java side (ActiveMQ is
embedded within JBOSS btw:)

ConnectionFactory cf1 = (ConnectionFactory)
ctx.lookup("TopicConnectionFactory");
Connection connection = cf1.createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Destination dest = (Topic) ctx.lookup("topic/SciTegic");
MessageProducer producer = session.createProducer(dest);
TextMessage msg = session.createTextMessage("TEST MESSAGE FOR MDB");

On the C++ side:
ActiveMQConnectionFactory* connectionFactory = new
ActiveMQConnectionFactory("tcp://127.0.0.1:61616?wireFormat=openwire&transport.useAsyncSend=true");

connection = connectionFactory->createConnection();
connection->start();
delete connectionFactory;
session = connection->createSession( Session::AUTO_ACKNOWLEDGE );


destination = session->createTopic( "TOPIC.SciTegic" ); // IS THIS THE RIGHT
NAME TO USE? 

 producer = session->createProducer( destination );
 producer->setDeliveryMode( DeliveryMode::NON_PERSISTENT );
string threadIdStr = Integer::toString( Thread::getId() );
 string text = (string)"Hello world! from thread " + threadIdStr;
TextMessage* message = session->createTextMessage( text );
 producer->send( message );
delete message;

Thanks again for all the help, this is driving me crazy!



tabish121 wrote:
> 
> You send the messages to a Destination with the same name as the one
> you've configured your MDB to listen on.  
> 
> regards
> Tim
> 
> On Wed, 2007-06-06 at 10:53 -0700, alexvs wrote:
>> Hi guys,
>> 
>> I need help!  I have two extra days to finish this project and I can't
>> figure out how to make my C++ client send messages to ActiveMQ and have
>> these messages delivered to my MDB.  I have the example running in C++,
>> but
>> I don't know how to locate the JMS topic or connection that would route
>> to
>> my MDB.
>> 
>> Any help would be greatly appreciated!
>> 
>> Thanks.
> 
> 

-- 
View this message in context: http://www.nabble.com/Integrating-C%2B%2B-Client-with-MDB-tf3879413s2354.html#a10995054
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Integrating C++ Client with MDB

Posted by Timothy Bish <ti...@sensis.com>.
You send the messages to a Destination with the same name as the one
you've configured your MDB to listen on.  

regards
Tim

On Wed, 2007-06-06 at 10:53 -0700, alexvs wrote:
> Hi guys,
> 
> I need help!  I have two extra days to finish this project and I can't
> figure out how to make my C++ client send messages to ActiveMQ and have
> these messages delivered to my MDB.  I have the example running in C++, but
> I don't know how to locate the JMS topic or connection that would route to
> my MDB.
> 
> Any help would be greatly appreciated!
> 
> Thanks.