Hi James,
>
>It sounds like your server is sending a response to a client which has
>already disconnected.
>--
>James
It might be James, But I am not getting this, thats why I am sending the
code of sender and receiver
Pls let me know what is the wrong with this code?
*******************************Sender**************************
p<IQueue> queue, queue1 ;
p<IMessageConsumer> consumer, consumer1 ;
p<IMessageProducer> producer ;
p<ITextMessage> message;
p<IDestination> qTemp;
char sJMSId[100];
sprintf(sJMSId, "JMSCorrelationID = '%s'", CorrelationID);
// Connect to a queue // for sending the message
queue = session->getQueue("FOO.BAR") ;
printf("\nCorrelation Id-> %s\n", CorrelationID);
// Create producer
producer = session->createProducer(queue) ;
producer->setPersistent(true) ;
////////// For Listening
qTemp = session->createTemporaryQueue();
consumer = session->createConsumer(qTemp, "JMSCorrelationID = 'username'") ;
consumer->setMessageListener( smartify(this) ) ;
//////////
while(1)
{
char MsgStr[50];
printf("\n\nEnter message : ");
fflush(stdin);
cin.getline(MsgStr, 500);
message = session->createTextMessage( MsgStr );
message->setJMSReplyTo(qTemp);
message->setJMSCorrelationID("username") ;
if (strcmp(MsgStr, "END")!=0)
{
producer->send(message);
sleep(1);
}
else
{
printf("\nTerminaing....\n");
sleep(1);
break;
}
}
// Wait for asynchronous message for 1s
semaphore.wait(1) ;
// Check if any error was registered by the message handler
if( error != NULL )
throw TraceException( error ) ;
*************************End Sender***********************
************************Receiver****************************
void TestReceiveQueue::onMessage(p<IMessage> message)
{
p<string> NGid;
p<ITextMessage> message2;
p<IDestination> qDestination;
char Replay[100]= {'s','a','i','f','i','1','a','r','a','s','h','a','d'};
p<string> sReceive;
if( message == NULL )
{
error = "Received a null message" ;
semaphore.notify() ;
return ;
}
NGid = message->getJMSCorrelationID();
if (strcmp((sReceive = mess->getText())->c_str(), "")!=0)
{
printf("\nRecieved message ->%s\n", mess->getText()->c_str());
producer = session->createProducer(message->getJMSReplyTo()) ;
strcat(Replay, mess->getText()->c_str());
message2 = session->createTextMessage(Replay);
message2->setJMSCorrelationID(NGid->c_str() );
producer->send(message->getJMSReplyTo(), message2) ;
}
else
{
printf("\nNULL Message Received\n");
}
}
Thanks
Arashad Ahamad
--
View this message in context:
http://www.nabble.com/How-to-create-a-temporary-Queue-tf2145190.html#a5962328
Sent from the ActiveMQ - Dev forum at Nabble.com.