Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: MethodInvokingAggregator requires the 'correlationKey' property?

  1. #11

    Default Two different gateways and messages

    Oleg,

    As you know from my example, I need two call two different services that each have different request/response messages. This is what makes this example more complicated. Before each gateway, I have a transformer that transforms the original message into a valid request message for each of the two services.

    The reply messages (which are different), are sent to the same channel where they are unmarshalled into object based messages and then sent to the aggregator.

    To test things out, I suppose I could use duplicate gateways and request/response messages.

    Is there a chance that the headers are being lost in any of the extra steps that I mentioned (transformers, unmarshaller)?

    -Joshua

  2. #12
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    Possible, let me look at it in the morning. I also try to use your transformers as a model

  3. #13

    Lightbulb User Error

    Oleg,

    I apologize, this appears to be user error. If you look at the gateway class, you will see the following annotation:

    @Gateway(requestChannel="enhancedTimelineRequest", replyChannel="enhancedTimelineResponse")

    But the request channel is actually specified as:

    <siublish-subscribe-channel id="enhancedTimelineRequests" task-executor="taskExecutor" apply-sequence="true"/>

    I did not receive any error indicating that the "enhancedTimelineRequest" channel didn't exist. I would like to better understand this behavior. When to channels need to be explicitly defined, and when do they not?

    -Joshua

  4. #14
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    OK, i am glad you've figured it out, because i've just added the transformer and everything still works fine.
    Here is the config I am using:
    Code:
    <si:gateway id="enhancedTimelineGateway" 
                    service-interface="integration.EnhancedTimelineGateway"/>
                    
    <si:header-enricher input-channel="enricherChannel" output-channel="enhancedTimelineRequest">
        	<si:header name="springintegration_http_requestMethod" value="GET"/>
    </si:header-enricher>
    
    <si:publish-subscribe-channel id="enhancedTimelineRequest" apply-sequence="true"/>
        
    <si:transformer input-channel="enhancedTimelineRequest" output-channel="httpGatewayA-channel">
        	<bean class="integration.TwitterMessageTransformer"/>
    </si:transformer>
    <si-http:outbound-gateway
    		request-channel="httpGatewayA-channel"
    		default-url="http://localhost:8080/test"
    		charset="UTF-8"
    		request-timeout="1234"	
    		reply-channel="aggregatorInputChannel"/>
    		
    <si:transformer input-channel="enhancedTimelineRequest" output-channel="httpGatewayB-channel">
        	<bean class="integration.WeatherUndergroundMessageTransformer"/>
    </si:transformer>	
    <si-http:outbound-gateway
    		request-channel="httpGatewayB-channel"
    		default-url="http://localhost:8080/test"
    		charset="UTF-8"
    		request-timeout="1234"	
    		reply-channel="aggregatorInputChannel"/>
    	
    <si:aggregator input-channel="aggregatorInputChannel"  method="prepareEnhancedTimeline">
            <bean class="integration.MessageAggregator"/>
    </si:aggregator>
    As far as the second question, you don't have to define channels explicitly if:
    1) there is an element that contains attribute input-channel
    2) you are OK with it being Direct channel
    For example, this configuration is sufficient:
    Code:
    <service-activator input-channel="foo".../>
    foo channel will be auto-created as Direct channel.
    However if you want it to be any other channel (pub-sub, queue etc.), then you would have to define it explicitly.

  5. #15

    Default ConversionNotSupportedException

    My next headache...

    If I take out my unmarshaller and have two different message types returned to my aggregator, everything works fine. My message signature looks like this:

    public EnhancedTimeline prepareEnhancedTimeline(List<?> items)

    I am using the wildcard because I expect two different types of messages to be flowing into the aggregator.

    When I put my unmarshaller (which uses jaxb to unmarshall to two different objects) in between, I receive the following exception:

    Exception in thread "main" org.springframework.beans.ConversionNotSupportedEx ception: Failed to convert value of type 'org.springframework.integration.transformer.Messa geTransformationException' to required type 'integration.EnhancedTimeline'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.integration.transformer.Messag eTransformationException] to required type [integration.EnhancedTimeline]: no matching editors or conversion strategy found
    at org.springframework.beans.SimpleTypeConverter.conv ertIfNecessary(SimpleTypeConverter.java:53)
    at org.springframework.beans.SimpleTypeConverter.conv ertIfNecessary(SimpleTypeConverter.java:41)
    at org.springframework.integration.gateway.GatewayPro xyFactoryBean.invokeGatewayMethod(GatewayProxyFact oryBean.java:210)
    at org.springframework.integration.gateway.GatewayPro xyFactoryBean.invoke(GatewayProxyFactoryBean.java: 172)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :172)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:202)
    at $Proxy1.getEnhancedTimeline(Unknown Source)
    at integration.EnhancedTimelineServiceImpl.getEnhance dTimeline(EnhancedTimelineServiceImpl.java:18)
    at integration.AggregationDemo.performDemo(Aggregatio nDemo.java:32)
    at integration.AggregationDemo.main(AggregationDemo.j ava:23)
    Caused by: java.lang.IllegalStateException: Cannot convert value of type [org.springframework.integration.transformer.Messag eTransformationException] to required type [integration.EnhancedTimeline]: no matching editors or conversion strategy found
    at org.springframework.beans.TypeConverterDelegate.co nvertIfNecessary(TypeConverterDelegate.java:291)
    at org.springframework.beans.TypeConverterDelegate.co nvertIfNecessary(TypeConverterDelegate.java:105)
    at org.springframework.beans.SimpleTypeConverter.conv ertIfNecessary(SimpleTypeConverter.java:47)
    ... 9 more


    I have tested the unmarshaller earlier and it works fine. The weird thing is that the only class that is interested in creating/returning a EnhancedTimeline class is the aggregator (which is currently just returning an empty EnhancedTimeline object) and it does not complain when the unmarshaller is taken out of the mix.

    Can someone help me understand what might be happening here?

  6. #16
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    Can you debug your Unmarshaller? THis exception is a very standard Spring exception which tells you that one type can not be converted to another type because there are no converters found. Of course registering Converter or TYpe Editor is a very simple task, but what troubles me is that it attempts to convert Exception to a non-exception type. So who throws org.springframework.integration.transformer.Messag eTransformationException?

  7. #17

    Default Spoke to soon

    I generated my own twitter schema based on a single response from twitter. When I changed users, something within the xml from twitter changed. Long story short, I am all set. Thanks for your help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •