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)); }
// ---------------------------------- 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)))); }
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)))); }
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)); }
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)); }