I am building an aggregation process for upserting records. I have a scatter-gather subflow where each path queries a Salesforce environment, maps the data into a consistent output List of Maps, and after the scatter-gather passes the message into the Combine Collections transformer. The output is an ArrayList of all of the values I need to the upsert as part of batch processing.
The issue is that when the Arraylist is passed to the Process step Mule throws the following error:
Object "org.mule.transport.NullPayload" not of correct type. It must be of type "{interface java.lang.Iterable,interface java.util.Iterator,interface org.mule.routing.MessageSequence,interface java.util.Collection}" (java.lang.IllegalArgumentException) (com.mulesoft.module.batch.exception.BatchException). Message payload is of type: NullPayload
Using Mule Debugger I can see that the payload at the completion of the Input phase is not null and is of type ArrayList. If I simplify the flow, remove the scatter-gather so that the input phase is simply a query and DataMapper I still receive the same error.
How can you take a list of maps and process them using the Batch processing feature?
Input phase:
</processor-chain>
<processor-chain>
<sfdc:query config-ref="Salesforce-B" query="dsql:SELECT Amount,CloseDate,CreatedDate,Id,LeadSource,Name,OwnerId,Primary_Source__c,Probability,StageName FROM Opportunity WHERE lastModifiedDate > #[lastUpdate]" doc:name="B" fetchSize="10"/>
<logger message="B has #[payload.size().toString()] Opportunities for upsert" level="INFO" doc:name="Logger"/>
<data-mapper:transform config-ref="List_Opportunity__To_Map_B" doc:name="Opp to Sales B"/>
</processor-chain>
</scatter-gather>
<combine-collections-transformer doc:name="Combine Collections"/>