protected override IMessageHandler CreateProducerMessageHandler(IProducerDestination destination, IProducerOptions producerProperties, IMessageChannel errorChannel) { var handler = new BridgeHandler(ApplicationContext) { OutputChannel = ((SpringIntegrationProducerDestination)destination).Channel }; return(handler); }
protected override IMessageHandler CreateProducerMessageHandler(IProducerDestination destination, IProducerOptions producerProperties, IMessageChannel errorChannel) { if (producerProperties.HeaderMode == HeaderMode.EmbeddedHeaders) { throw new InvalidOperationException("The RabbitMQ binder does not support embedded headers since RabbitMQ supports headers natively"); } var extendedProperties = BindingsOptions.GetRabbitProducerOptions(producerProperties.BindingName); var prefix = extendedProperties.Prefix; var exchangeName = destination.Name; var destinationName = string.IsNullOrEmpty(prefix) ? exchangeName : exchangeName[prefix.Length..];
public DefaultProducingMessageChannelBinding( AbstractMessageChannelBinder binder, string destination, IMessageChannel target, ILifecycle lifecycle, IProducerOptions options, IProducerDestination producerDestination) : base(destination, target, lifecycle) { this.binder = binder; this.options = options; this.producerDestination = producerDestination; }
public DefaultProducingMessageChannelBinding( AbstractMessageChannelBinder binder, string destination, IMessageChannel target, ILifecycle lifecycle, IProducerOptions options, IProducerDestination producerDestination, ILogger logger = null) : base(destination, target, lifecycle) { _binder = binder; _options = options; _producerDestination = producerDestination; _logger = logger; }
private void DestroyErrorInfrastructure(IProducerDestination destination) { var errorChannelName = GetErrorsBaseName(destination); var errorBridgeHandlerName = GetErrorBridgeName(destination); if (_destinationRegistry.Lookup(errorChannelName) is ISubscribableChannel channel) { if (_destinationRegistry.Lookup(errorBridgeHandlerName) is IMessageHandler bridgeHandler) { channel.Unsubscribe(bridgeHandler); _destinationRegistry.Deregister(errorBridgeHandlerName); } _destinationRegistry.Deregister(errorChannelName); } }
private void DestroyErrorInfrastructure(IProducerDestination destination) { var errorChannelName = GetErrorsBaseName(destination); var errorBridgeHandlerName = GetErrorBridgeName(destination); if (ApplicationContext.GetService <IMessageChannel>(errorChannelName) is ISubscribableChannel channel) { if (ApplicationContext.GetService <IMessageHandler>(errorBridgeHandlerName) is IMessageHandler bridgeHandler) { channel.Unsubscribe(bridgeHandler); ApplicationContext.Deregister(errorBridgeHandlerName); } ApplicationContext.Deregister(errorChannelName); } }
private ISubscribableChannel RegisterErrorInfrastructure(IProducerDestination destination) { var errorChannelName = GetErrorsBaseName(destination); ISubscribableChannel errorChannel; var errorChannelObject = _destinationRegistry.Lookup(errorChannelName); if (errorChannelObject != null) { if (!(errorChannelObject is ISubscribableChannel)) { throw new InvalidOperationException("Error channel '" + errorChannelName + "' must be a ISubscribableChannel"); } errorChannel = (ISubscribableChannel)errorChannelObject; } else { errorChannel = new PublishSubscribeChannel(ServiceProvider); _destinationRegistry.Register(errorChannelName, errorChannel); } var defaultErrorChannel = (IMessageChannel)_destinationRegistry.Lookup(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME); if (defaultErrorChannel != null) { var errorBridge = new BridgeHandler(ServiceProvider) { OutputChannel = defaultErrorChannel }; errorChannel.Subscribe(errorBridge); var errorBridgeHandlerName = GetErrorBridgeName(destination); _destinationRegistry.Register(errorBridgeHandlerName, errorBridge); } return(errorChannel); }
protected virtual string GetErrorBridgeName(IProducerDestination destination) { return(GetErrorsBaseName(destination) + ".bridge"); }
protected virtual string GetErrorsBaseName(IProducerDestination destination) { return(destination.Name + ".errors"); }
protected virtual void AfterUnbindProducer(IProducerDestination destination, IProducerOptions producerOptions) { }
protected abstract IMessageHandler CreateProducerMessageHandler(IProducerDestination destination, IProducerOptions producerProperties, IMessageChannel errorChannel);
protected virtual IMessageHandler CreateProducerMessageHandler(IProducerDestination destination, IProducerOptions producerProperties, IMessageChannel channel, IMessageChannel errorChannel) { return(CreateProducerMessageHandler(destination, producerProperties, errorChannel)); }