예제 #1
0
        public static QueueConsumerPair Consume(IQueue queue, Action <byte[], MessageProperties, MessageReceivedInfo> onMessage)
        {
            Preconditions.CheckNotNull(queue, nameof(queue));
            Preconditions.CheckNotNull(onMessage, nameof(onMessage));

            return(new QueueConsumerPair(queue, (bytes, properties, info) => TaskHelpers.ExecuteSynchronously(() => onMessage(bytes, properties, info)), null));
        }
예제 #2
0
        // ---------------------------------- consume --------------------------------------

        public IDisposable Consume <T>(IQueue queue, Action <IMessage <T>, MessageReceivedInfo> onMessage) where T : class
        {
            Preconditions.CheckNotNull(queue, "queue");
            Preconditions.CheckNotNull(onMessage, "onMessage");

            return(Consume <T>(queue, (message, info) => TaskHelpers.ExecuteSynchronously(() => onMessage(message, info))));
        }
예제 #3
0
        public static QueueConsumerPair Create <T>(IQueue queue, Action <IMessage <T>, MessageReceivedInfo> onMessage) where T : class
        {
            Preconditions.CheckNotNull(queue, nameof(queue));
            Preconditions.CheckNotNull(onMessage, nameof(onMessage));

            return(Create <T>(queue, (message, info) => TaskHelpers.ExecuteSynchronously(() => onMessage(message, info))));
        }
예제 #4
0
        public virtual ISubscriptionResult Subscribe <T>(string subscriptionId, Action <T> onMessage, Action <ISubscriptionConfiguration> configure) where T : class
        {
            Preconditions.CheckNotNull(subscriptionId, "subscriptionId");
            Preconditions.CheckNotNull(onMessage, "onMessage");
            Preconditions.CheckNotNull(configure, "configure");

            return(SubscribeAsync <T>(subscriptionId, msg => TaskHelpers.ExecuteSynchronously(() => onMessage(msg)), configure));
        }
예제 #5
0
 public IDisposable Consume(IQueue queue, Action <byte[], MessageProperties, MessageReceivedInfo> onMessage, Action <IConsumerConfiguration> configure)
 {
     return(Consume(queue, (bytes, properties, info) => TaskHelpers.ExecuteSynchronously(() => onMessage(bytes, properties, info)), configure));
 }