mirror of https://github.com/apache/activemq.git
Added little snippet to example for wiki
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@380777 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
eb52635994
commit
0461466367
|
@ -31,16 +31,13 @@ namespace openwire_dotnet
|
|||
{
|
||||
Console.WriteLine("About to connect to ActiveMQ");
|
||||
|
||||
// START SNIPPET: example
|
||||
IConnectionFactory factory = new ConnectionFactory("localhost", 61616);
|
||||
|
||||
Console.WriteLine("Worked!");
|
||||
|
||||
using (IConnection connection = factory.CreateConnection())
|
||||
{
|
||||
Console.WriteLine("Created a connection!");
|
||||
|
||||
ISession session = connection.CreateSession();
|
||||
Console.WriteLine("Created a session: " + session);
|
||||
|
||||
IDestination destination = session.GetQueue("FOO.BAR");
|
||||
Console.WriteLine("Using destination: " + destination);
|
||||
|
@ -50,25 +47,22 @@ namespace openwire_dotnet
|
|||
IMessageProducer producer = session.CreateProducer(destination);
|
||||
string expected = "Hello World!";
|
||||
|
||||
|
||||
ITextMessage request = session.CreateTextMessage(expected);
|
||||
|
||||
producer.Send(request);
|
||||
|
||||
Console.WriteLine("### About to receive message...");
|
||||
ActiveMQTextMessage message = (ActiveMQTextMessage) consumer.Receive();
|
||||
if (message == null)
|
||||
{
|
||||
Console.WriteLine("### No message!!");
|
||||
Console.WriteLine("No message received!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("### Received message: " + message + " of type: " + message.GetType());
|
||||
String actual = message.Text;
|
||||
|
||||
Console.WriteLine("### Message text is: " + actual);
|
||||
Console.WriteLine("Received message with text: " + actual);
|
||||
}
|
||||
}
|
||||
// END SNIPPET: example
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue