Resources

More

csharp.example.client.cs

usingSystem;usingOrg.Apache.Qpid.Messaging;namespaceOrg.Apache.Qpid.Messaging.Examples{classClient{staticintMain(string[]args){Stringurl="amqp:tcp:127.0.0.1:5672";StringconnectionOptions="";if(args.Length>0)url=args[0];if(args.Length>1)connectionOptions=args[1];Connectionconnection=newConnection(url,connectionOptions);try{connection.Open();Sessionsession=connection.CreateSession();Sendersender=session.CreateSender("service_queue");AddressresponseQueue=newAddress("#response-queue; {create:always, delete:always}");Receiverreceiver=session.CreateReceiver(responseQueue);String[]s=newString[]{"Twas brillig, and the slithy toves","Did gire and gymble in the wabe.","All mimsy were the borogroves,","And the mome raths outgrabe."};Messagerequest=newMessage("");request.ReplyTo=responseQueue;for(inti=0;i<s.Length;i++){request.SetContent(s[i]);sender.Send(request);Messageresponse=receiver.Fetch();Console.WriteLine("{0} -> {1}",request.GetContent(),response.GetContent());}connection.Close();return0;}catch(Exceptione){Console.WriteLine("Exception {0}.",e);connection.Close();}return1;}}}