我将Mule批量提交为:
def advanced_dict(a_list=None):
if a_list is None:
a_list = []
index_holder = 0 # Holds the primary dict value
site_dict = {} # contains a dict of dicts
for sub_arr in big_array:
for site in sub_arr:
try:
site_dict['website'+str(index_holder)]
except KeyError:
site_dict['website'+str(index_holder)] = {} # if no dict create dict
try:
site_dict['website'+str(index_holder)][site] += 1
except KeyError:
site_dict['website'+str(index_holder)][site] = 1
index_holder += 1
index_holder = 0
return site_dict
如果我不进行批量提交,应用程序工作正常,但如果我使用批量提交,我收到以下错误消息:
<batch:step name="Batch_Step1">
<enricher source="#[message.payload]" target="#[recordVars.accountJson]" doc:name="Message Enricher">
<json:object-to-json-transformer doc:name="Object to JSON"/>
</enricher>
<batch:set-record-variable variableName="client_id" value="#[message.payload.client_id]" doc:name="client_id"/>
<batch:commit size="10" doc:name="Batch Commit">
<sfdc:query config-ref="SFDC_Config" query="dsql:SELECT Id FROM Account WHERE Client_ID__c = '#[message.payload.client_id]'" doc:name="Account-Query"/>
<set-payload value="#[message.payload.hasNext() ? message.payload.next(): 'none']" doc:name="sfdc-data"/>
</batch:commit>
</batch:step>
问题2)
无法在批量提交中使用recordVars。将错误视为:
INFO 2015-07-29 14:19:44,636 [batch-job-clientaccount-Batch-work-manager.01] com.mulesoft.module.batch.DefaultBatchStep: Found exception processing record on step 'Batch_Step1' for job instance '86987df0-3637-11e5-81ea-0026b9eef95d' of job 'clientaccount-Batch'.
This is the first record to show this exception on this step for this job instance. Subsequent records with the same failureswill not be logged for performance and log readability reasons:
********************************************************************************
Message : Failed to invoke query. Message payload is of type: RegularImmutableList
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. com.google.common.collect.RegularImmutableList cannot be cast to java.util.Map (java.lang.ClassCastException)
org.mule.mvel2.optimizers.impl.refl.nodes.MapAccessor:42 (null)
2. cannot invoke getter: getPayload [declr.class: org.mule.el.context.MessageContext; act.class: org.mule.el.context.MessageContext] (see trace) (java.lang.RuntimeException)
org.mule.mvel2.optimizers.impl.refl.nodes.GetterAccessor:74 (null)
3. Execution of the expression "message.payload.client_id" failed. (org.mule.api.expression.ExpressionRuntimeException)
org.mule.el.mvel.MVELExpressionLanguage:202 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/expression/ExpressionRuntimeException.html)
4. Failed to invoke query. Message payload is of type: RegularImmutableList (org.mule.api.MessagingException)
org.mule.devkit.processor.DevkitBasedMessageProcessor:133 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.lang.ClassCastException: com.google.common.collect.RegularImmutableList cannot be cast to java.util.Map
at org.mule.mvel2.optimizers.impl.refl.nodes.MapAccessor.getValue(MapAccessor.java:42)
at org.mule.mvel2.optimizers.impl.refl.nodes.GetterAccessor.getValue(GetterAccessor.java:40)
at org.mule.mvel2.optimizers.impl.refl.nodes.VariableAccessor.getValue(VariableAccessor.java:37)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************