public PartitioningInterceptor(IApplicationContext applicationContext, IBindingOptions bindingOptions, IPartitionKeyExtractorStrategy partitionKeyExtractorStrategy, IPartitionSelectorStrategy partitionSelectorStrategy)
 {
     _bindingOptions   = bindingOptions;
     _partitionHandler = new PartitionHandler(
         applicationContext,
         _bindingOptions.Producer,
         partitionKeyExtractorStrategy,
         partitionSelectorStrategy);
 }
예제 #2
0
 public PartitioningInterceptor(IExpressionParser expressionParser, IEvaluationContext evaluationContext, IBindingOptions bindingOptions, IPartitionKeyExtractorStrategy partitionKeyExtractorStrategy, IPartitionSelectorStrategy partitionSelectorStrategy)
 {
     _bindingOptions   = bindingOptions;
     _partitionHandler = new PartitionHandler(
         expressionParser,
         evaluationContext,
         _bindingOptions.Producer,
         partitionKeyExtractorStrategy,
         partitionSelectorStrategy);
 }
        public void ConfigurePolledMessageSource(IPollableMessageSource binding, string name)
        {
            IBindingOptions bindingOptions  = Options.GetBindingOptions(name);
            var             contentType     = bindingOptions.ContentType;
            var             consumerOptions = bindingOptions.Consumer;

            if ((consumerOptions == null || !consumerOptions.UseNativeDecoding) &&
                binding is DefaultPollableMessageSource source)
            {
                source.AddInterceptor(
                    new InboundContentTypeEnhancingInterceptor(contentType));
            }
        }
        private void ConfigureMessageChannel(IMessageChannel channel, string channelName, bool inbound)
        {
            if (channel is not Integration.Channel.AbstractMessageChannel messageChannel)
            {
                throw new ArgumentException(nameof(channel) + " not an AbstractMessageChannel");
            }

            IBindingOptions bindingOptions  = Options.GetBindingOptions(channelName);
            var             contentType     = bindingOptions.ContentType;
            var             producerOptions = bindingOptions.Producer;

            if (!inbound && producerOptions != null && producerOptions.IsPartitioned)
            {
                messageChannel.AddInterceptor(
                    new PartitioningInterceptor(
                        new SpelExpressionParser(),
                        null,
                        bindingOptions,
                        GetPartitionKeyExtractorStrategy(producerOptions),
                        GetPartitionSelectorStrategy(producerOptions)));
            }

            var consumerOptions = bindingOptions.Consumer;

            if (IsNativeEncodingNotSet(producerOptions, consumerOptions, inbound))
            {
                if (inbound)
                {
                    messageChannel.AddInterceptor(
                        new InboundContentTypeEnhancingInterceptor(contentType));
                }
                else
                {
                    messageChannel.AddInterceptor(
                        new OutboundContentTypeConvertingInterceptor(
                            contentType,
                            _messageConverterFactory.MessageConverterForAllRegistered));
                }
            }
        }
예제 #5
0
 public ExpressionGenerator(IBindingOptions options)
 {
     bindingOptions = options;
 }
예제 #6
0
 public ModelExpressionBuilder()
 {
     options = new BindingOptions();
 }