Announcement Announcement Module
Collapse
No announcement yet.
Error using Groovy script Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error using Groovy script

    I'm trying to activate a service listener, calling a method as named in a header value "discriminator". Here is the snippet that attempts to set this up:

    HTML Code:
    <int:chain input-channel="request-channel" output-channel="reply-channel">
        <int:header-enricher>
            <int:header name="service" ref="listenerBean" />
        </int:header-enricher>
        <int:service-activator>
            <int-groovy:script><![CDATA[
                headers['service']."${headers['discriminator']}"(payload)
                ]]></int-groovy:script>
        </int:service-activator>
    </int:chain>
    When this point of the request processor is reached, this error is thrown:

    ERROR org.springframework.integration.handler.LoggingHan dler -
    All attempts to deliver Message to MessageHandlers failed. Multiple causes:
    org.springframework.expression.spel.SpelEvaluation Exception: EL1004Epos 8): Method call: Method setCustomizer(java.lang.String) cannot be found on org.springframework.integration.groovy.GroovyScrip tExecutingMessageProcessor type failed to transform message
    Googling this, I found this Jira, which links at the end with this text: Issued PR for maint 2.0.6

    My question is, is this the same issue? And if so, how do I get to this level of code so that I can get by it? Right now I'm using SI version 2.1.0.RELEASE. Do I need to go to a snapshot version?

  • #2
    Right now I'm using SI version 2.1.0.RELEASE. Do I need to go to a snapshot version?
    Yes! You're right! Please, get the latest 2.1.1 snapshot.
    Or change your <int:service-activator> to <int:transformer>

    Good luck,
    Artem Bilan

    Comment


    • #3
      Thanks, Cleric. Changing to a transformer gets me over the first problem. Now I have another. I send a message using a gateway. Each method of the gateway sets a distinct header value into the message. But since I am using AMQP to physically deliver the message to RabbitMQ, AMQP is disregarding any property value whose header is not predefined in DefaultAmqpHeaderMapper. So even though my header value is being successfully added to the message, AMQP strips it out.

      Any idea on how to get around this?

      Comment


      • #4
        Use the mapped-request-headers attribute on the amqp adapter(s) to add custom headers...

        Code:
        mapped-request-headers="abc, def"

        Comment


        • #5
          Works like a charm. This is a serious milestone--I am successfully adapting a service interface to seamlessly invoke a remote method.

          Comment

          Working...
          X