using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Transactions;
using Rhino.Queues;
namespace Test
{
class Program : IDisposable
{
private static QueueManager receiver;
private static QueueManager sender;
static void Main(string[] args)
{
var receiver = new QueueManager(new IPEndPoint(IPAddress.Loopback, 4545), "receiver.esent");
receiver.CreateQueues("test");
receiver.Start();
var sender = new QueueManager(new IPEndPoint(IPAddress.Loopback, 4546), "sender.esent");
sender.Start();
using (var tx = new TransactionScope())
{
sender.Send(new Uri("rhino.queues://localhost:4545/test"),
new MessagePayload
{
Data = Encoding.ASCII.GetBytes("Test message")
});
tx.Complete();
}
while (true)
{
using (var tx = new TransactionScope())
{
try
{
var msg = receiver.Receive("test", new TimeSpan(0, 0, 5));
Console.WriteLine(msg.Id.MessageIdentifier.ToString() + ": " + Encoding.ASCII.GetString(msg.Data));
tx.Complete();
Console.WriteLine("\tTX complete");
}
catch (TimeoutException)
{
Console.WriteLine("\tTimeout");
break;
}
}
Console.WriteLine("\tTX end");
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
Console.WriteLine("Press Enter to exit");
Console.ReadLine();
}
public void Dispose()
{
if (sender != null)
sender.Dispose();
if (receiver != null)
receiver.Dispose();
}
}
}
--
You received this message because you are subscribed to the Google Groups "Rhino Tools Dev" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rhino-tools-dev/-/Q4YMdLpCo60J.
To post to this group, send email to rhino-t...@googlegroups.com.
To unsubscribe from this group, send email to rhino-tools-d...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rhino-tools-dev?hl=en.
Changing message 4b1efc58-dac7-40c9-9157-6193bf77b816/f8ea75df-598c-4eaa-9137-9f880082c76a status to ReadyToDeliver on test
2011-10-26 07:56:08,514 DEBUG Starting to listen on 127.0.0.1:4545
2011-10-26 07:56:09,018 DEBUG Starting to listen on 127.0.0.1:4546
2011-10-26 07:56:09,093 DEBUG Enlisting in the current transaction with enlistment id: c577d4d2-0a54-4d9c-bff0-eb4a5ac898c8
2011-10-26 07:56:09,102 DEBUG Created output message 'f8ea75df-598c-4eaa-9137-9f880082c76a' for 'rhino.queues://localhost:4545/test/' as NotReady
2011-10-26 07:56:09,103 DEBUG Committing enlistment with id: c577d4d2-0a54-4d9c-bff0-eb4a5ac898c8
2011-10-26 07:56:09,107 DEBUG Marking output message -118852129 as Ready
2011-10-26 07:56:09,108 DEBUG Commited enlistment with id: c577d4d2-0a54-4d9c-bff0-eb4a5ac898c8
2011-10-26 07:56:09,109 DEBUG Enlisting in the current transaction with enlistment id: 7c8606c1-6f49-490d-a4dd-e310c91eefca
2011-10-26 07:56:10,035 DEBUG Scanning message f8ea75df-598c-4eaa-9137-9f880082c76a with status Ready to be sent at 10/26/2011 07:56:09
2011-10-26 07:56:10,036 DEBUG Adding message f8ea75df-598c-4eaa-9137-9f880082c76a to returned messages
2011-10-26 07:56:10,042 DEBUG Marking output message f8ea75df-598c-4eaa-9137-9f880082c76a as InFlight
2011-10-26 07:56:11,070 DEBUG Starting to send 1 messages to localhost:4545
2011-10-26 07:56:11,102 DEBUG Scanning message f8ea75df-598c-4eaa-9137-9f880082c76a with status InFlight to be sent at 10/26/2011 07:56:09
2011-10-26 07:56:11,138 DEBUG Accepting connection from 127.0.0.1:50224
2011-10-26 07:56:11,141 DEBUG Successfully connected to localhost:4545
2011-10-26 07:56:11,142 DEBUG Writing length of 70 bytes to localhost:4545
2011-10-26 07:56:11,149 DEBUG Writing 70 bytes to localhost:4545
2011-10-26 07:56:11,151 DEBUG Successfully wrote to localhost:4545
2011-10-26 07:56:11,154 DEBUG Reading 70 bytes from 127.0.0.1:50224
2011-10-26 07:56:11,155 DEBUG Deserialized 1 messages from 127.0.0.1:50224
2011-10-26 07:56:11,163 DEBUG Enqueuing msg to 'test' with subqueue: ''. Id: 4b1efc58-dac7-40c9-9157-6193bf77b816/f8ea75df-598c-4eaa-9137-9f880082c76a
2011-10-26 07:56:11,165 DEBUG All messages from 127.0.0.1:50224 were accepted
2011-10-26 07:56:11,165 DEBUG Sending reciept notice to 127.0.0.1:50224
2011-10-26 07:56:11,165 DEBUG Reading acknowledgement about accepting messages to 127.0.0.1:50224
2011-10-26 07:56:11,168 DEBUG Changing message 4b1efc58-dac7-40c9-9157-6193bf77b816/f8ea75df-598c-4eaa-9137-9f880082c76a status to ReadyToDeliver on test
2011-10-26 07:56:11,172 DEBUG Scanning incoming message 4b1efc58-dac7-40c9-9157-6193bf77b816/f8ea75df-598c-4eaa-9137-9f880082c76a on 'test/' with status ReadyToDeliver
2011-10-26 07:56:11,172 DEBUG Dequeuing message 4b1efc58-dac7-40c9-9157-6193bf77b816/f8ea75df-598c-4eaa-9137-9f880082c76a from 'test/'
2011-10-26 07:56:11,173 DEBUG Successfully sent output message -118852129
2011-10-26 07:56:11,187 DEBUG Committing enlistment with id: 7c8606c1-6f49-490d-a4dd-e310c91eefca
2011-10-26 07:56:11,225 DEBUG Moving message 4b1efc58-dac7-40c9-9157-6193bf77b816/f8ea75df-598c-4eaa-9137-9f880082c76a on queue test to history
2011-10-26 07:56:11,250 DEBUG Commited enlistment with id: 7c8606c1-6f49-490d-a4dd-e310c91eefca
2011-10-26 07:56:33,652 DEBUG Changing message 4b1efc58-dac7-40c9-9157-6193bf77b816/f8ea75df-598c-4eaa-9137-9f880082c76a status to ReadyToDeliver on test
2011-10-26 07:56:33,761 DEBUG Starting to listen on 127.0.0.1:4545
2011-10-26 07:56:35,446 DEBUG Starting to listen on 127.0.0.1:4546
2011-10-26 07:56:35,555 DEBUG Enlisting in the current transaction with enlistment id: b126ec27-f08f-4532-a38c-1d1537e3a563
2011-10-26 07:56:35,555 DEBUG Created output message 'b5720e4b-64f2-462e-a488-9f880082e66b' for 'rhino.queues://localhost:4545/test/' as NotReady
2011-10-26 07:56:35,555 DEBUG Committing enlistment with id: b126ec27-f08f-4532-a38c-1d1537e3a563
2011-10-26 07:56:35,555 DEBUG Marking output message -1250816437 as Ready
2011-10-26 07:56:35,571 DEBUG Commited enlistment with id: b126ec27-f08f-4532-a38c-1d1537e3a563
2011-10-26 07:56:35,571 DEBUG Enlisting in the current transaction with enlistment id: 4f8167b4-dfbb-4c21-b406-27c5a3c43699
2011-10-26 07:56:35,586 DEBUG Scanning incoming message 4b1efc58-dac7-40c9-9157-6193bf77b816/f8ea75df-598c-4eaa-9137-9f880082c76a on 'test/' with status ReadyToDeliver
2011-10-26 07:56:35,586 DEBUG Dequeuing message 4b1efc58-dac7-40c9-9157-6193bf77b816/f8ea75df-598c-4eaa-9137-9f880082c76a from 'test/'
2011-10-26 07:56:35,617 DEBUG Committing enlistment with id: 4f8167b4-dfbb-4c21-b406-27c5a3c43699
2011-10-26 07:56:35,617 DEBUG Moving message 4b1efc58-dac7-40c9-9157-6193bf77b816/f8ea75df-598c-4eaa-9137-9f880082c76a on queue test to history
2011-10-26 07:56:35,617 DEBUG Commited enlistment with id: 4f8167b4-dfbb-4c21-b406-27c5a3c43699
2011-10-26 07:56:35,617 DEBUG Enlisting in the current transaction with enlistment id: a322be97-bb15-4433-871e-f103c5dcf226
2011-10-26 07:56:36,522 DEBUG Scanning message b5720e4b-64f2-462e-a488-9f880082e66b with status Ready to be sent at 10/26/2011 07:56:35
2011-10-26 07:56:36,522 DEBUG Adding message b5720e4b-64f2-462e-a488-9f880082e66b to returned messages
2011-10-26 07:56:36,522 DEBUG Marking output message b5720e4b-64f2-462e-a488-9f880082e66b as InFlight
2011-10-26 07:56:37,489 DEBUG Starting to send 1 messages to localhost:4545
2011-10-26 07:56:37,505 DEBUG Scanning message b5720e4b-64f2-462e-a488-9f880082e66b with status InFlight to be sent at 10/26/2011 07:56:35
2011-10-26 07:56:37,551 DEBUG Accepting connection from 127.0.0.1:50230
2011-10-26 07:56:37,551 DEBUG Successfully connected to localhost:4545
2011-10-26 07:56:37,551 DEBUG Writing length of 70 bytes to localhost:4545
2011-10-26 07:56:37,551 DEBUG Writing 70 bytes to localhost:4545
2011-10-26 07:56:37,551 DEBUG Successfully wrote to localhost:4545
2011-10-26 07:56:37,567 DEBUG Reading 70 bytes from 127.0.0.1:50230
2011-10-26 07:56:37,567 DEBUG Deserialized 1 messages from 127.0.0.1:50230
2011-10-26 07:56:37,567 DEBUG Enqueuing msg to 'test' with subqueue: ''. Id: 4b1efc58-dac7-40c9-9157-6193bf77b816/b5720e4b-64f2-462e-a488-9f880082e66b
2011-10-26 07:56:37,567 DEBUG All messages from 127.0.0.1:50230 were accepted
2011-10-26 07:56:37,567 DEBUG Sending reciept notice to 127.0.0.1:50230
2011-10-26 07:56:37,567 DEBUG Reading acknowledgement about accepting messages to 127.0.0.1:50230
2011-10-26 07:56:37,567 DEBUG Changing message 4b1efc58-dac7-40c9-9157-6193bf77b816/b5720e4b-64f2-462e-a488-9f880082e66b status to ReadyToDeliver on test
2011-10-26 07:56:37,583 DEBUG Scanning incoming message 4b1efc58-dac7-40c9-9157-6193bf77b816/b5720e4b-64f2-462e-a488-9f880082e66b on 'test/' with status ReadyToDeliver
2011-10-26 07:56:37,583 DEBUG Dequeuing message 4b1efc58-dac7-40c9-9157-6193bf77b816/b5720e4b-64f2-462e-a488-9f880082e66b from 'test/'
2011-10-26 07:56:37,583 DEBUG Committing enlistment with id: a322be97-bb15-4433-871e-f103c5dcf226
2011-10-26 07:56:37,583 DEBUG Moving message 4b1efc58-dac7-40c9-9157-6193bf77b816/b5720e4b-64f2-462e-a488-9f880082e66b on queue test to history
2011-10-26 07:56:37,598 DEBUG Successfully sent output message -1250816437
2011-10-26 07:56:37,614 DEBUG Commited enlistment with id: a322be97-bb15-4433-871e-f103c5dcf226
2011-10-26 07:56:37,614 DEBUG Enlisting in the current transaction with enlistment id: 25923573-76a3-484f-add2-6169276cf353
2011-10-26 07:56:42,668 DEBUG Rolling back enlistment with id: 25923573-76a3-484f-add2-6169276cf353
2011-10-26 07:56:42,668 DEBUG Rolledback enlistment with id: 25923573-76a3-484f-add2-6169276cf353
--
You received this message because you are subscribed to the Google Groups "Rhino Tools Dev" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rhino-tools-dev/-/OfOEYD0FQksJ.
--
You received this message because you are subscribed to the Google Groups "Rhino Tools Dev" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rhino-tools-dev/-/QBPrcPjiFVQJ.