[rabbitmq-discuss] Is Connection is thead safe?

sameekmishra sameek at arosys.com
Tue Nov 22 07:44:10 GMT 2011


Hi

I have created worker threads  that consume message from same queue.

 class wokerThread implements Runnable 
{
     public Connection connection;
     public workThread(Connection conn)
     {this.connection=conn;
     }

      public void run() 
      {
          Channel channel=connection.createchannel();
          //read message from queue 
     }
   
}


public class TestThreads 
{
public static void main (String [] args) 
{
Thread[] worker=new Thread[3];
wokerThread  r = new wokerThread ;

for(int i=0;i<3;i++)
{
 
   worker[i]=new Thread(r);
   worker[i].start();

}
}
}

I got the following error:

java.lang.IllegalStateException: cannot execute more than one synchronous
AMQP command at a time

 please help me where the problem in my code.

Regrads


-- 
View this message in context: http://old.nabble.com/Is-Connection-is-thead-safe--tp32872118p32872118.html
Sent from the RabbitMQ mailing list archive at Nabble.com.



More information about the rabbitmq-discuss mailing list