/// <summary> /// <see cref="Publish{T}(MassTransit.IServiceBus,object)"/>: this /// overload further takes an action; it allows you to set <see cref="IPublishContext"/> /// meta-data. Also <see cref="IServiceBus.Publish{T}"/>. /// </summary> /// <typeparam name="T">The type of the message to publish</typeparam> /// <param name="bus">The bus to publish the message on.</param> /// <param name="values">The dictionary of values to become hydrated and /// published under the type of the interface.</param> /// <param name="contextCallback">The context callback.</param> public static void Publish <T>(this IServiceBus bus, object values, Action <IPublishContext <T> > contextCallback) where T : class { var message = InterfaceImplementationExtensions.InitializeProxy <T>(values); bus.Publish(message, contextCallback); }
/// <summary> /// <see cref="IServiceBus.Publish{T}"/>: this is a "dynamically" /// typed overload - give it an interface as its type parameter, /// and a loosely typed dictionary of values and the MassTransit /// underlying infrastructure will populate an object instance /// with the passed values. It actually does this with DynamicProxy /// in the background. /// </summary> /// <typeparam name="T">The type of the interface or /// non-sealed class with all-virtual members.</typeparam> /// <param name="bus">The bus to publish on.</param> /// <param name="values">The dictionary of values to place in the /// object instance to implement the interface.</param> public static void Publish <T>(this IServiceBus bus, object values) where T : class { var message = InterfaceImplementationExtensions.InitializeProxy <T>(values); bus.Publish(message, x => { }); }
/// <summary> /// Sends an interface message, initializing the properties of the interface using the anonymous /// object specified /// </summary> /// <typeparam name="T">The interface type to send</typeparam> /// <param name="endpoint">The destination endpoint</param> /// <param name="values">The property values to initialize on the interface</param> /// <param name="contextCallback">A callback method to modify the send context for the message</param> public void Send <T>(object values, Action <ISendContext <T> > contextCallback) where T : class { var message = InterfaceImplementationExtensions.InitializeProxy <T>(values); Send(message, contextCallback); }
/// <summary> /// Sends an interface message, initializing the properties of the interface using the anonymous /// object specified /// </summary> /// <typeparam name="T">The interface type to send</typeparam> /// <param name="endpoint">The destination endpoint</param> /// <param name="values">The property values to initialize on the interface</param> public void Send <T>(object values) where T : class { var message = InterfaceImplementationExtensions.InitializeProxy <T>(values); Send(message, x => { }); }
public void Publish <T>(object values, Action <IPublishContext <T> > contextCallback) where T : class { if (values == null) { throw new ArgumentNullException("values"); } var message = InterfaceImplementationExtensions.InitializeProxy <T>(values); Publish(message, contextCallback); }
public void Publish <T>(object values) where T : class { if (values == null) { throw new ArgumentNullException("values"); } var message = InterfaceImplementationExtensions.InitializeProxy <T>(values); Publish(message, x => { }); }
public static Message <T> Send <T>(this UntypedChannel channel, object values) where T : class { if (!typeof(T).IsInterface) { throw new ArgumentException("Default Implementations can only be created for interfaces"); } var message = InterfaceImplementationExtensions.InitializeProxy <T>(values); var messageImpl = new MessageImpl <T>(message); channel.Send <Message <T> >(messageImpl); return(messageImpl); }
public static Request <TRequest> Request <TRequest>(this Channel <Request <TRequest> > channel, object values, UntypedChannel responseChannel) where TRequest : class { if (!typeof(TRequest).IsInterface) { throw new ArgumentException("Default Implementations can only be created for interfaces"); } var request = InterfaceImplementationExtensions.InitializeProxy <TRequest>(values); var requestImpl = new RequestImpl <TRequest>(responseChannel, request); channel.Send(requestImpl); return(requestImpl); }