protected override void ConfigureMessageConverter(NmsTemplate nmsTemplate, INmsHeaderMapper headerMapper)
 {
     IMessageConverter converter = nmsTemplate.MessageConverter;
     if (converter == null || !(converter is HeaderMappingMessageConverter))
     {
         HeaderMappingMessageConverter hmmc = new HeaderMappingMessageConverter(converter, headerMapper);
         hmmc.ExtractIntegrationMessagePayload = extractPayload;
         nmsTemplate.MessageConverter = hmmc;
     }
 }
コード例 #2
0
 protected override void ConfigureMessageConverter(NmsTemplate nmsTemplate, INmsHeaderMapper headerMapper)
 {
     IMessageConverter converter = nmsTemplate.MessageConverter;
     if (converter == null || !(converter is HeaderMappingMessageConverter))
     {
         HeaderMappingMessageConverter hmmc = new HeaderMappingMessageConverter(converter, headerMapper);
         hmmc.ExtractIntegrationMessagePayload = extractPayload;
         nmsTemplate.MessageConverter = hmmc;
     }
 }
コード例 #3
0
        public void AfterPropertiesSet()
        {
            HeaderMappingMessageConverter headerMappingMessageConverter =
                messageConverter as HeaderMappingMessageConverter;

            if (headerMappingMessageConverter == null)
            {
                HeaderMappingMessageConverter hmmc = new HeaderMappingMessageConverter(messageConverter, headerMapper);
                hmmc.ExtractNmsMessageBody            = extractRequestPayload;
                hmmc.ExtractIntegrationMessagePayload = extractReplyPayload;
                messageConverter = hmmc;
            }
        }
        public void DefaultHeaderMappingMessageConverter()
        {
            ChannelPublishingJmsMessageListener listener = new ChannelPublishingJmsMessageListener();

            listener.AfterPropertiesSet();
            HeaderMappingMessageConverter hmmc = GetHmmc(listener);

            Assert.That(hmmc, Is.Not.Null);
            SimpleMessageConverter smc = hmmc.GetType().GetField("converter", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(hmmc) as
                                         SimpleMessageConverter;

            Assert.That(smc, Is.Not.Null);
        }
        public void CustomMessageConverterDecoratedForHeaderMapping()
        {
            ChannelPublishingJmsMessageListener listener = new ChannelPublishingJmsMessageListener();
            IMessageConverter originalConverter          = new TestMessageConverter();

            listener.MessageConverter = originalConverter;
            listener.AfterPropertiesSet();
            HeaderMappingMessageConverter hmmc = GetHmmc(listener);

            Assert.That(hmmc, Is.Not.Null);

            TestMessageConverter smc = hmmc.GetType().GetField("converter", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(hmmc) as
                                       TestMessageConverter;

            Assert.That(smc, Is.Not.Null);
        }
コード例 #6
0
 public void AfterPropertiesSet()
 {
     lock (initializationMonitor)
     {
         if (initialized)
         {
             return;
         }
         AssertUtils.ArgumentNotNull(connectionFactory, "connectionFactory must not be null");
         AssertUtils.IsTrue(requestDestination != null || requestDestinationName != null,
                            "Either a 'requestDestination' or 'requestDestinationName' is required.");
         if (messageConverter == null)
         {
             HeaderMappingMessageConverter hmmc = new HeaderMappingMessageConverter(null, headerMapper);
             hmmc.ExtractIntegrationMessagePayload = extractRequestPayload;
             hmmc.ExtractNmsMessageBody            = extractReplyPayload;
             messageConverter = hmmc;
         }
         initialized = true;
     }
 }
コード例 #7
0
 public void AfterPropertiesSet()
 {
     lock (initializationMonitor)
     {
         if (initialized)
         {
             return;
         }
         AssertUtils.ArgumentNotNull(connectionFactory, "connectionFactory must not be null");
         AssertUtils.IsTrue(requestDestination != null || requestDestinationName != null,
                            "Either a 'requestDestination' or 'requestDestinationName' is required.");
         if (messageConverter == null)
         {
             HeaderMappingMessageConverter hmmc = new HeaderMappingMessageConverter(null, headerMapper);
             hmmc.ExtractIntegrationMessagePayload = extractRequestPayload;
             hmmc.ExtractNmsMessageBody = extractReplyPayload;
             messageConverter = hmmc;
         }
         initialized = true;
     }
 }
 public void AfterPropertiesSet()
 {
     HeaderMappingMessageConverter headerMappingMessageConverter =
         messageConverter as HeaderMappingMessageConverter;
     if (headerMappingMessageConverter == null)
     {
         HeaderMappingMessageConverter hmmc = new HeaderMappingMessageConverter(messageConverter, headerMapper);
         hmmc.ExtractNmsMessageBody = extractRequestPayload;
         hmmc.ExtractIntegrationMessagePayload = extractReplyPayload;
         messageConverter = hmmc;
     }
 }