/// <summary> /// Subscribe a component to the pipeline that handles every message /// </summary> /// <typeparam name="TComponent"></typeparam> /// <param name="pipeline">The pipeline to configure</param> /// <param name="instance">The instance that will handle the messages</param> /// <returns></returns> public static UnsubscribeAction ConnectInstance <TComponent>(this IInboundMessagePipeline pipeline, TComponent instance) where TComponent : class { return(pipeline.Configure(x => { InstanceConnector connector = InstanceConnectorCache.GetInstanceConnector <TComponent>(); return connector.Connect(x, instance); })); }
/// <summary> /// Connects any consumers for the object to the message dispatcher /// </summary> /// <param name="connector">The service bus to configure</param> /// <param name="instance"></param> /// <returns> /// The unsubscribe action that can be called to unsubscribe the instance /// passed as an argument. /// </returns> public static ConnectHandle ConnectInstance(this IConsumePipeConnector connector, object instance) { if (connector == null) { throw new ArgumentNullException(nameof(connector)); } if (instance == null) { throw new ArgumentNullException(nameof(instance)); } return(InstanceConnectorCache.GetInstanceConnector(instance.GetType()).ConnectInstance(connector, instance)); }
/// <summary> /// Connects any consumers for the object to the message dispatcher /// </summary> /// <param name="bus">The service bus to configure</param> /// <param name="instance"></param> /// <returns>The unsubscribe action that can be called to unsubscribe the instance /// passed as an argument.</returns> public static ConnectHandle ConnectInstance(this IBus bus, object instance) { if (bus == null) { throw new ArgumentNullException(nameof(bus)); } if (instance == null) { throw new ArgumentNullException(nameof(instance)); } IInstanceConnector connector = InstanceConnectorCache.GetInstanceConnector(instance.GetType()); return(connector.ConnectInstance(bus, instance)); }
public void Configure(IReceiveEndpointBuilder builder) { InstanceConnectorCache.GetInstanceConnector(_instance.GetType()).ConnectInstance(builder, _instance); }
public static ConnectHandle ConnectInstance(this IConsumePipeConnector filter, object instance) { return(InstanceConnectorCache.GetInstanceConnector(instance.GetType()).ConnectInstance(filter, instance)); }