activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "amq user" <amq.u...@gmail.com>
Subject Re: active-cpp persistent problem
Date Fri, 08 Dec 2006 20:35:10 GMT
I do see the message is "NON-PERSISTENT" from jconsole using browse().
No matter how I set it (persistent or non-persisten) in the cpp code. I got
"NON_PERSISTENT". Please help!


On 12/8/06, amq user <amq.user@gmail.com> wrote:
>
>  ActiveMQ 4.0.2 and activemq-cpp-1.0
>
>
>
> On 12/8/06, Bish, Tim <Tim.Bish@sensis.com> wrote:
> >
> > What version of the broker are you using?
> >
> > Regards
> >
> > Tim
> >
> >
> >
> > > -----Original Message-----
> > > From: amq user [mailto:amq.user@gmail.com]
> > > Sent: Friday, December 08, 2006 2:37 PM
> > > To: activemq-dev@geronimo.apache.org
> > > Subject: Re: active-cpp persistent problem
> > >
> > > On 12/8/06, Bish, Tim < Tim.Bish@sensis.com> wrote:
> > > >
> > > >
> > > > AFAIK the activemq-cpp message do properly send the persistant flag.
> > > >
> > > > Can you create a small test app that demonstrates to problem?
> > >
> > >
> > > yes. my test code is just a copy of main.cpp from the example.
> > >
> > > run method looks like:
> > >
> > >     virtual void run() {
> > >         try {
> > >             // Open test message file
> > >             FILE *fd;
> > >             if ( (fd = fopen(messageFile.c_str(), "r")) == NULL) {
> > >                 cout<<"Error: Can't open file: "<<messageFile<<endl;
> > >                 return;
> > >             }
> > >
> > >             ActiveMQConnectionFactory* connectionFactory = new
> > > ActiveMQConnectionFactory("tcp://10.111.53.230:22222");
> > >             // Create a Connection
> > >             connection = connectionFactory->createConnection();
> > >             connection->start();
> > >             // Create a Session
> > >             session = connection->createSession(
> > Session::AUTO_ACKNOWLEDGE
> > > );
> > >
> > >             // Create the destination (Topic or Queue)
> > >             destination = session->createQueue( "TEST.FOO" );
> > >
> > >             // Create a MessageProducer from the Session to the Topic
> > or
> > > Queue
> > >             producer = session->createProducer( destination );
> > >             producer->setDeliveryMode( DeliveryMode::PERSISTANT );
> > >
> > >             // Create the Thread Id String
> > >             string threadIdStr = Integer::toString( Thread::getId() );
> > >
> > >             // Create a messages
> > >             string texts = (string)"<START_PERFORM_TEST>";
> > >             string texte = (string)"<END_PERFORM_TEST>";
> > >             TextMessage* message_s = session->createTextMessage(
> > > string(texts) );
> > >
> > >             producer->send( message_s );
> > >             delete message_s;
> > >
> > >             char * line = NULL;
> > >             size_t len = 0;
> > >             ssize_t read;
> > >             for( int ix=0; ix<numMessages; ++ix ){
> > >                 fseek(fd,0L,SEEK_SET);
> > >                 while((read = getline(&line,&len,fd)) != -1) {
> > >                 //TextMessage* message = session->createTextMessage(
> > text
> > > );
> > >                 TextMessage* message = session->createTextMessage(
> > > string(line) );
> > >
> > >                 // Tell the producer to send the message
> > >                 //printf( "Sent message from thread %s\n",
> > > threadIdStr.c_str()
> > > );
> > >                 producer->send( message );
> > >
> > >                 delete message;
> > >                 }
> > >             }
> > >
> > >             TextMessage* message_e = session->createTextMessage(
> > > string(texte) );
> > >             producer->send( message_e );
> > >             delete message_e;
> > >
> > >             if(line)
> > >                 free(line);
> > >
> > >        }catch ( CMSException& e ) {
> > >             e.printStackTrace();
> > >         }
> > >     }
> > >
> > >
> > >
> > >
> > > What are the steps you are currently following in both cases?  Are you
> > > > sending messages with the C++ client and they are not persistant
> > when
> > > > you restart and connect a C++ client back to the broker, or have you
> >
> > > > tried sending a message persistantly with C++ and then connecting
> > back
> > > > with a Java client to see if that gets the messages that should have
> > > > been persisted?
> > >
> > >
> > > I used the cpp code above to send some messages. And they are gone
> > after I
> > > restart the broker. I tried to use cpp consumer to get those messages.
> > > Actually, I don't need to restart the message to see if it is
> > consistent
> > > or
> > > not.  If i send enough message to the broker, jconsole says
> > > MemoryPercentageUsed: 100. and I got this:
> > > activemq::io::SocketOutputStream::write - Resource temporarily
> > unavailable
> > > -
> > > tid: 3085880224
> > >         FILE: activemq/network/SocketOutputStream.cpp, LINE: 85 - tid:
> >
> > > 3085880224
> > >         FILE: activemq/connector/stomp/StompCommandWriter.cpp, LINE:
> > 101 -
> > > tid: 3085880224
> > >         FILE: ./activemq/transport/ResponseCorrelator.h, LINE: 163 -
> > tid:
> > > 3085880224
> > > caught unknown exception - tid: 3085880224
> > >         FILE: activemq/connector/stomp/StompConnector.cpp, LINE: 466 -
> > > tid:
> > > 3085880224
> > >         FILE: activemq/core/ActiveMQSession.cpp, LINE: 495 - tid:
> > > 3085880224
> > >         FILE: activemq/core/ActiveMQProducer.cpp, LINE: 89 - tid:
> > > 3085880224
> > >         FILE: activemq/core/ActiveMQProducer.cpp, LINE: 71 - tid:
> > > 3085880224
> > > caught unknown exception
> > >         FILE: activemq/connector/stomp/StompConnector.cpp, LINE: 466
> > >         FILE: activemq/core/ActiveMQSession.cpp, LINE: 495
> > >         FILE: activemq/core/ActiveMQProducer.cpp, LINE: 89
> > >         FILE: activemq/core/ActiveMQProducer.cpp, LINE: 71
> > >
> > > Thanks
> > >
> > >
> > >
> > >
> > >
> > > Regards
> > > >
> > > > Tim.
> > > >
> > > > > -----Original Message-----
> > > > > From: amq user [mailto: amq.user@gmail.com]
> > > > > Sent: Friday, December 08, 2006 2:10 PM
> > > > > To: activemq-dev
> > > > > Subject: active-cpp persistent problem
> > > > >
> > > > > I'm struggling with persistent option in activemq-cpp client. (my
> > java
> > > > > client does the trick)
> > > > > part of my code looks like:
> > > > >
> > > > > producer->setDeliveryMode( DeliveryMode::PERSISTANT );
> > > > >
> > > > > The problem is after I send a message, and stop the broker. The
> > > > message is
> > > > > gone.
> > > > > If I send a lot of message exceeding the memory size the broker
> > > > handles, I
> > > > > got resource unavailable exception.
> > > > >
> > > > > It looks to me the message I send over using cpp doesn't instruct
> > the
> > > > > broker
> > > > > to use persistent.
> > > > > I'm using ActiveMQ 4.0.2, and activemq-cpp-1.0.
> > > > >
> > > > > Please help. What else should I check. Did I miss anything?
> > > > > Thanks
> > > >
> >
>
>

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