Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-4122

Error "MessageHeaders is immutable" in AbstractKeyValueMessageStore normalizeMessage

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Complete
    • 4.2.4
    • 5.0.M1
    • Redis Support
    • int-amqp + int-redis + int-claimcheck

    Description

      Trying to use claim-check with Redis store with a message coming from amqp throws "MessageHeaders is immutable" error.

      The error is thrown when trying to change message ID in AbstractKeyValueMessageStore.normalizeMessage

      		Map innerMap = (Map) new DirectFieldAccessor(normalizedMessage.getHeaders()).getPropertyValue("headers");
      		innerMap.put(MessageHeaders.ID, message.getHeaders().getId());
      

      Configuration is

      	<int-amqp:inbound-gateway id="signInRabbit"
      		request-channel="signResponses" 
      		message-converter="jsonMessageConverter"
      		error-channel="signErrorChannel"
      		connection-factory="rabbitConnectionFactory"
      		mapped-request-headers="*"
      		mapped-reply-headers="*"
      		/>
      	<int:chain input-channel="signResponses"
      		>
      		<int:header-enricher>
      			<int:error-channel value="signErrorChannel"/>
      		</int:header-enricher>
      		<int:claim-check-out id="checkoutServer"
      	        message-store="redisMessageStore" />
        ......
      

      Work around is override
      RedisMessageStore.getMessage(UUID id) to the contents of AbstractKeyValueMessageStore.getRawMessage(UUID)

      @Override
      	public Message<?> getMessage(UUID id) {
      		Assert.notNull(id, "'id' must not be null");
      		Object message = doRetrieve(MESSAGE_KEY_PREFIX + id);
      		return (Message<?>) message;
      
      	}
      

      Maybe related to INT-2460

      Attachments

        Issue Links

          Activity

            People

              abilan Artem Bilan
              niconavarrete Nico
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: