0
votes

I'm using mule standalone 3.4. I am trying to create a flow using the Salesforce connector to perform a query operation and then pass the payload to a spring component. The result is the component doesn't get called.

    <flow name="sfcdContact" doc:name="sfcdContact">
    <quartz:inbound-endpoint repeatInterval="2000" 
                             startDelay="3000" 
                             jobName="sfcdContact">
        <quartz:event-generator-job/>
    </quartz:inbound-endpoint> 
    <sfdc:query config-ref="Salesforce" 
                query="${salesforce.query.contact}" 
                doc:name="sfcdContactQuery"/>
    <component>
        <spring-object bean="salesForceConsumer"/>      
    </component>
    <catch-exception-strategy doc:name="Catch Exception Strategy">
        <flow-ref name="ErrorHandling"/>
    </catch-exception-strategy> 
</flow> 

If I remove the sfdc portion from the flow, the spring component is successfully invoked. If I remove the component portion from the flow and replace it with:

         <logger message="\#\#\# query operation payload \#[payload]" level="INFO" doc:name="Logger"/>

The results are successfully entered into the log. So it seems the pieces work correctly individually.

I have the logs set to debug, and no errors are reported.

Here's the Java code:

 public class SalesForceConsumer {

    public Object consume(@Payload Object payload) throws Exception {
        System.out.println("SalesForceConsumer::consume called");
        return payload;
    }


 }

I also tried modifying the signature to:

 public Object consume(@Payload HashMap<String,Object> payload)

Which is what the doc indicates is returned from the connector.

Is there any reason why the Salesforce connector can't be combined with a bean, or do I have it configured incorrectly? Thank-you.

1
Add the code of your component? Also mention if it is giving an error? How did you find that it is not calling the component? - user1760178
Hi user1760178 - I updated my issue with the info you requested. Thx. - bottabing
try modifying your component to a Mule aware component by implementing the Callable Interface. You can have access to the MuleMessage. Which you can debug and check. - user1760178
The onCall() method never gets executed. Thanks any way. - bottabing
By the way you can ask Salesforce questions directly on salesforce.stackexchange.com - mast0r

1 Answers

0
votes

I ran your code on Mule EE 3.4 and it worked just fine.

The console output:

INFO 2015-03-26 18:37:51,903 org.mule.api.processor.LoggerMessageProcessor: \#\#\# query operation payload \[{FirstName=Test, Id=null, type=Contact}]
SalesForceConsumer::consume called

The flow:

<spring:beans>
    <spring:bean id="salesForceConsumer" name="salesForceConsumer" class="com.acme.util.SalesForceConsumer"/>
</spring:beans>
<sfdc:config name="Salesforce" username="XXXX" password="XXXX" securityToken="XXXX" url="https://login.salesforce.com/services/Soap/u/28.0" doc:name="Salesforce">
    <sfdc:connection-pooling-profile initialisationPolicy="INITIALISE_ONE"  exhaustedAction="WHEN_EXHAUSTED_GROW"/>
</sfdc:config>
<flow name="sfcdContact" doc:name="sfcdContact">
    <quartz:inbound-endpoint repeatInterval="2000" startDelay="3000" jobName="sfcdContact">
       <quartz:event-generator-job/>
    </quartz:inbound-endpoint> 
    <sfdc:query config-ref="Salesforce" query="select FirstName from Contact" doc:name="sfcdContactQuery"/>
    <logger message="\#\#\# query operation payload \#[payload]" level="INFO" doc:name="Logger"/>
    <component>
       <spring-object bean="salesForceConsumer"/>      
    </component>
</flow>