I have some further questions, I hope you don't mind. Your library
seems easier to use than the CCR for example but while your outline
above was clear enough conceptually I would appreciate it if the code
below does what you intended. This is the step that hands off the
object from the middleware (rabbitmq in this case) to internal
subscribers. ProcessMessage cracks the message and calls
channel.publish(). OnNewData is an event whose delegate is generically
typed. This will probably be slow but I am still figuring out how to
reuse all this code in a way that cleanly specifies the message
payload type and requires not much rewriting by different clients.
using( internalPublisher = new ThreadFiber())
{
internalPublisher.Start();
Retlang.Channels.IChannel<IncomingType>
retlangChannel = new Channel<IncomingType>();
retlangChannel.Subscribe(internalPublisher,
delegate(IncomingType obj){
if( OnNewData != null )
{
OnNewData(obj);
}
});
Console.WriteLine("Consumer tag: " +
sub.ConsumerTag);
foreach (BasicDeliverEventArgs e in sub)
{
ProcessMessage(e,retlangChannel);
if (Encoding.UTF8.GetString(e.Body) ==
"quit")
{
Console.WriteLine("Quitting!");
break;
}
}
Console.WriteLine("out of messaging loop");