Hi,
I have attached the code snippet of run method of Receiver that i am using.

Little more description of the problem:- 
1) Now i see sometime session got created but while creating the consumer it 
throws exception.
2) when i change the name of the queue for producer and consumer then they 
start fine, but i can see messages coming to the consumer when send the message 
to the broker through different producer (created seperately), seems to me 
session has been created properly.

Many thanks in advance...

~Rakesh


----- Original Message ----
From: Timothy Bish <[EMAIL PROTECTED]>
To: [email protected]
Sent: Tuesday, 12 June, 2007 5:06:13 PM
Subject: Re: Getting exception in creating the session for the receivers...


Can you attach a small sample that demonstrates the problem.  Have you
tried the same code using a static library using the official 2.0.1
release?  SVN Trunk is not a release and is not guaranteed to work, its
a work in progress.  

On Tue, 2007-06-12 at 16:59 +0530, Rakesh Kumar wrote:
> Hi,
> 
> I am using tcp port 61616 and the brokerURL that i am passing is 
> 
> "tcp://127.0.0.1:61616?wireFormat=openwire&transport.useAsyncSend=true";    
> 
> 
> 
> Strange behavior that i see is when i start only sender or receiver
> this problem does not occur. this occur only when they start on the
> same queue.
> 
> 
> 
> I am using 4.1 broker and  2.1 client (I have downloaded the source from svn 
> and have built the dll of activemq-cpp) 
> 
> 
> Please let me know if you need any other information.
> 
> Note:- I have created VS2003 project for this and have created the dll of 
> activemq from VS2003 itself.
> Same problem is happening in VS2005 build dlls also.
> 
> 
> ~Rakesh
> 
> ----- Original Message ----
> From: Albert Strasheim <[EMAIL PROTECTED]>
> To: [email protected]
> Sent: Tuesday, 12 June, 2007 4:44:26 PM
> Subject: Re: Getting exception in creating the session for the receivers...
> 
> Hello
> 
> On Tue, 12 Jun 2007, Rakesh Kumar wrote:
> 
> > To Add in here i am getting the stack trace as follows
> > 
> > In the RunMethod Exception
> > response from futureResponse was invalid
> >         FILE: 
> > \activemq-2.1\src_org\main\activemq\transport\filters\ResponseCorrelator.cpp,
> >  LINE: 146
> > 
> > Thanks in advance...
> 
> Just guessing here, but are possibly trying to use the Openwire wire 
> protccol to connect to the Stomp port on the broker, i.e. port 61613 
> instead of port 61616?
> 
> Cheers,
> 
> Albert
> 
> 
> 
> 
> 
> 
> 
>       Download prohibited? No problem! To chat from any browser without 
> download, Click Here: http://in.messenger.yahoo.com/webmessengerpromo.php


      Download prohibited? No problem! To chat from any browser without 
download, Click Here: http://in.messenger.yahoo.com/webmessengerpromo.php
void AmqJMSReceiver::run() 
{
        APPLOGGER_TRACE_STR("=> AmqJMSReceiver::run");
    bool t_retval=false;            
    try {
                do{
                        // Create a ConnectionFactory
                        ActiveMQConnectionFactory* t_connectionFactory = 
                                new ActiveMQConnectionFactory( m_brokerURI );
                        APPLOGGER_TRACE("=> AmqJMSReceiver::run : Created 
Connection Factory for server URL " <<brokerURI<<endl);

                        if (t_connectionFactory == NULL){
                                APPLOGGER_TRACE_STR("=> AmqJMSReceiver::run : 
Connection factory is NULL");
                                t_retval=false;
                                break;
                        }

                        if (t_connectionFactory == NULL)
                        {
                                APPLOGGER_TRACE_STR("=> AmqJMSReceiver::run : 
Connection factory is NULL");
                        }
                        // Create the connection, use ssl if specified

                        // Create a Connection
                        //connection = 
connectionFactory->createConnection(userName,password,clientId);
                        m_connection = t_connectionFactory->createConnection();
                        APPLOGGER_TRACE_STR("=> AmqJMSReceiver::run : Created 
Connection");
                        // free the factory, we are done with it.
                        //delete t_connectionFactory;

                        if (m_connection == NULL){
                                APPLOGGER_TRACE_STR("=> AmqJMSReceiver::start : 
Connection factory is NULL");
                                t_retval=false;
                                break;
                        }


                        m_connection->start();
                        APPLOGGER_TRACE_STR("=> AmqJMSReceiver::run : Started 
Connection");

                        m_connection->setExceptionListener(this);
                        APPLOGGER_TRACE_STR("=> AmqJMSReceiver::run : Set the 
Exception Listner for the connection");

                        // Create a Session
                        m_session = m_connection->createSession( 
Session::AUTO_ACKNOWLEDGE );
                        APPLOGGER_TRACE_STR("=> AmqJMSReceiver::run : Created 
the session for the connection");

                        // Create the destination (Topic or Queue)
                        if (m_useTopic)
                                m_destination = m_session->createTopic( 
m_destName );
                        else
                                m_destination = m_session->createQueue( 
m_destName );
                        APPLOGGER_TRACE("=> AmqJMSReceiver::run : Created the 
Destination"<<destName);

                        // Create a MessageConsumer from the Session to the 
Topic or Queue
                        m_consumer = m_session->createConsumer( m_destination );
                        APPLOGGER_TRACE_STR("=> AmqJMSReceiver::run : Created 
Consumer");
                        m_consumer->setMessageListener( this );

                        /* read messages */
        /*              while(receive) 
                        {
                                try{
                                        const Message* message;
                                        //receive the message 
                                        message = consumer->receive();          
        

                                        const TextMessage* textMessage = 
                                                dynamic_cast< const 
TextMessage* >( message );
                                        string text = textMessage->getText();
                                        APPLOGGER_TRACE("=> AmqJMSReceiver::run 
: Received: " << text.c_str());
                                        delete message;
                                } catch (CMSException& e) {
                                        e.printStackTrace();
                                }
                        }
        */      
                        std::cout.flush();
                        std::cerr.flush();

                        // Sleep while asynchronous messages come in.
                        Thread::sleep( m_waitMillis );

                }while(false);      
    } catch (CMSException& e) {
        e.printStackTrace();
    }
}

Reply via email to