Disclaimer: Not a professional developer
We're using SSIS to pull messages RabbitMQ, and I've managed to build a C# script component that pulls and pops messages off our queue for us using Queue.Dequeue(). So far, so good. However, we want to have some form of automatic check in place so our SSIS component won't be running continuously, but rather can be scheduled to run every n minutes.
I found the Dequeue(int timeout, out object result) method for this, and have managed to implement it like so: (we'd like the BasiocDeliverEventArgs result in order to process the body of the message)
object message;
myConsumer.Queue.Dequeue(millisecondsTimeout: 500, result:out message);
BasicDeliverEventArgs ea = (BasicDeliverEventArgs)message;
This seems to work, but somehow feel somewhat redundant to me. This, for example, seems more intuitive to me:
myConsumer.Queue.Dequeue(millisecondsTimeout: 500
, result:out (BasicDeliverEventArgs)message)
But that yields an error specifying invalid arguments. Could someone please explain why it would throw that error, and why that syntax is invalid?
Queue<T>. Look into generics.