public static IAsyncResult BeginSendRequest <TRequest>(this IEndpoint endpoint, TRequest message, IServiceBus bus, AsyncCallback callback, object state, Action <IInlineRequestConfigurator <TRequest> > configureCallback) where TRequest : class { var configurator = new InlineRequestConfigurator <TRequest>(message); configureCallback(configurator); IAsyncRequest <TRequest> request = configurator.Build(bus); endpoint.Send(message, context => configurator.ApplyContext(context, bus.Endpoint.Address.Uri)); return(request.BeginAsync(callback, state)); }
public static bool PublishRequest <TRequest>(this IServiceBus bus, TRequest message, Action <IInlineRequestConfigurator <TRequest> > configureCallback) where TRequest : class { var configurator = new InlineRequestConfigurator <TRequest>(message); configureCallback(configurator); IAsyncRequest <TRequest> request = configurator.Build(bus); bus.Publish(message, context => configurator.ApplyContext(context, bus.Endpoint.Address.Uri)); return(request.Wait()); }