0
votes

I am stuck up with a problem with the request-reply router in mule. I am using the mule release 3.4.0. The request-reply is used in a fork-join pattern , i followed this article on the blog site http://blogs.mulesoft.org/aggregation-with-mule-fork-and-join-pattern/.

    <request-reply>
      <all enableCorrelation="ALWAYS">
        <vm:outbound-endpoint path="PathA"/>
        <vm:outbound-endpoint path="PathB"/>
      </all>
      <vm:inbound-endpoint path="FinalResponse">
         <message-properties-transformer>
              <add-message-property key="MULE_CORRELATION_GROUP_SIZE" value="2" />
         </message-properties-transformer>
         <collection-aggregator />
      </vm:inbound-endpoint>
    </request-reply>

The issue that i face is the processor placed after the request-reply is not reached.In mule i see 2 responses been sent to the FinalResponse vm endpoint. I tried placing my own custom aggregator in place of the collection-aggregator. But this is not reached. I am not sure how i can debug this issue. Please note that i have 2 such request-reply routers in two flows. Can someone help on this.

Adding the mule configuration. For abbrevity attaching only the parent flow and one of the child flow

ParentFlow

    <flow name="ParentFlow" doc:name="ParentFlow" tracking:enable-default-events="true">
    <file:inbound-endpoint path="${SourceFilePath}"
        connector-ref="ParentFlowInboundConnector" 
        responseTimeout="10000" tracking:enable-default-events="true">
        <file:filename-regex-filter pattern="${REGEX}" caseSensitive="false"/>

    </file:inbound-endpoint>

    <object-to-string-transformer doc:name="Object to String"/>
    <message-properties-transformer
        doc:name="Message Properties">
        <add-message-property key="Source_System" value="XXX" />
        <add-message-property key="publisherName" value="YYY" />
        <add-message-property key="FlowName" value="ZZZ"/>
    </message-properties-transformer>
    <!-- This would store the message in the db -->
    <wire-tap>
        <vm:outbound-endpoint path="PERSITENCE.OUT"/>
    </wire-tap>

    <request-reply>
            <all doc:name="Move the message to all endpoints" enableCorrelation="ALWAYS">
                <vm:outbound-endpoint path="PathA"/>
                <vm:outbound-endpoint path="PathB"/>
                <vm:outbound-endpoint path="PathC"/>
                <vm:outbound-endpoint path="PathD"/>
            </all>
        <vm:inbound-endpoint path="Response">               
            <message-properties-transformer>                    
                <add-message-property key="MULE_CORRELATION_GROUP_SIZE" value="4" />                
            </message-properties-transformer>               
            <collection-aggregator failOnTimeout="false" doc:name="Collection Aggregator" />
        </vm:inbound-endpoint>

    </request-reply>
    <component class="ProcessorA"  />
    <component class="ProcessorB" />
    <exception-strategy ref="Exception Strategy" doc:name="Reference Exception Strategy"/>
</flow>

Child Flow

<flow name="PathA" doc:name="PathA">
    <vm:inbound-endpoint path="PathA" >
        <vm:transaction action="ALWAYS_BEGIN"/>
    </vm:inbound-endpoint>
    <message-properties-transformer doc:name="Message Properties">                  
        <add-message-property key="originalFilename_processing" value="#[message.inboundProperties.originalFilename]" />                
    </message-properties-transformer>
    <message-properties-transformer doc:name="Message Properties">                  
        <add-message-property key="directory" value="#[message.inboundProperties.directory]" />             
    </message-properties-transformer>

    <message-properties-transformer doc:name="Message Properties">
        <add-message-property key="Destination_System" value="XXX" />
    </message-properties-transformer>

    <file:outbound-endpoint path="${OutPathA}" connector-ref="FileConnector_1" 
        tracking:enable-default-events="true"/>

    <!--Send email alerts -->
     <all doc:name="All" >
        <processor-chain>
            <message-property-filter pattern="turnOffEmail=false" caseSensitive="true" doc:name="Message Property"/>
            <custom-transformer class="com.XXX.YYY.ZZZ.VelocityTemplateResolver" doc:name="Java">
                <spring:property name="flowName" value="PPPP"/>
            </custom-transformer>
            <smtp:outbound-endpoint host="${SMTP_HOSTNAME}" port="${SMTP_PORT}" user="${SMTP_USERNAME}" password="${SMTP_PASSWORD}" to="${TO_ADDRESS}" from="${FROM_ADDRESS}" subject="${MAIL_SUBJECT}" cc="${MAIL_CC_ADDRESS}" bcc="${MAIL_BCC_ADDRESS}" responseTimeout="10000" transformer-refs="emailVelocityMessageTransformer"  tracking:enable-default-events="true"/>
        </processor-chain>
        <processor-chain>
            <message-property-filter pattern="turnOffEmail=false" caseSensitive="true" doc:name="Message Property"/>
            <custom-transformer class="com.XXX.YYY.ZZZ.VelocityTemplateResolver" doc:name="Java">
                <spring:property name="flowName" value="FlowName"/>
            </custom-transformer>
            <smtp:outbound-endpoint host="${SMTP_HOSTNAME}" port="${SMTP_PORT}" user="${SMTP_USERNAME}" password="${SMTP_PASSWORD}" to="${MAIL_TO_ADDRESS}" from="${MAIL_FROM_ADDRESS}" subject="${MAIL_SUBJECT}" cc="${MAIL_CC_ADDRESS}" bcc="${BCC_ADDRESS}" responseTimeout="10000" transformer-refs="emailVelocityMessageTransformer" tracking:enable-default-events="true"/>
        </processor-chain>
        <processor-chain>
            <message-property-filter pattern="turnOffEmail=false" caseSensitive="true" doc:name="Message Property"/>
            <custom-transformer class="com.XXX.YYY.ZZZ.VelocityTemplateResolver" doc:name="Java">
                <spring:property name="flowName" value="AAAA"/>
            </custom-transformer>
            <smtp:outbound-endpoint host="${SMTP_HOSTNAME}" port="${SMTP_PORT}" user="${SMTP_USERNAME}" password="${SMTP_PASSWORD}" to="${MAIL_TO_ADDRESS}" from="${MAIL_FROM_ADDRESS}" subject="${MAIL_SUBJECT}" cc="${MAIL_CC_ADDRESS}" bcc="${MAIL_BCC_ADDRESS}" responseTimeout="10000" transformer-refs="emailVelocityMessageTransformer" tracking:enable-default-events="true"/>
        </processor-chain>
    </all>
    <rollback-exception-strategy doc:name="Rollback Exception Strategy" maxRedeliveryAttempts="${MAX_REDELIVERY_ATTEMPTS}" enableNotifications="false">
        <logger message="==Rollback log ===" level="INFO" doc:name="Logger"/>
    </rollback-exception-strategy>
</flow>
1
If my vm endpoints are transactional PathA and PathB will this cause a problem - user2714010

1 Answers

0
votes

The most likely cause of the the problem is correlation ID.

You might want to inspect the correlation ID of the messages sent out to Path A and Path B. The message received on FinalResponse VM inbound endpoint needs to have the same correlation ID, otherwise it won't be accepted as a response to the messages previously sent. In other words the request-reply will NOT accept just anything in the inbound-endpoint but just the message matching the correlation ID of the posted on outbound-endpoint with the request-reply router.

You can set the custom correlation ID using this --

<set-property propertyName="MULE_CORRELATION_ID" value="some-correlation-id" />