mirror of https://github.com/apache/activemq.git
Updated the example program
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@381308 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3582300af6
commit
4bf76c23ca
|
@ -42,15 +42,21 @@ namespace openwire_dotnet
|
|||
IDestination destination = session.GetQueue("FOO.BAR");
|
||||
Console.WriteLine("Using destination: " + destination);
|
||||
|
||||
// lets create a consumer and producer
|
||||
IMessageConsumer consumer = session.CreateConsumer(destination);
|
||||
|
||||
IMessageProducer producer = session.CreateProducer(destination);
|
||||
string expected = "Hello World!";
|
||||
producer.Persistent = true;
|
||||
|
||||
ITextMessage request = session.CreateTextMessage(expected);
|
||||
// lets send a message
|
||||
ITextMessage request = session.CreateTextMessage("Hello World!");
|
||||
request.JMSCorrelationID = "abc";
|
||||
request.JMSXGroupID = "cheese";
|
||||
request.Properties["myHeader"] = "James";
|
||||
|
||||
producer.Send(request);
|
||||
|
||||
// lets consume a message
|
||||
ActiveMQTextMessage message = (ActiveMQTextMessage) consumer.Receive();
|
||||
if (message == null)
|
||||
{
|
||||
|
@ -58,8 +64,8 @@ namespace openwire_dotnet
|
|||
}
|
||||
else
|
||||
{
|
||||
String actual = message.Text;
|
||||
Console.WriteLine("Received message with text: " + actual);
|
||||
Console.WriteLine("Received message with ID: " + message.JMSMessageId);
|
||||
Console.WriteLine("Received message with text: " + message.Text);
|
||||
}
|
||||
}
|
||||
// END SNIPPET: example
|
||||
|
|
Loading…
Reference in New Issue