How to use a stored procedure with batch processing Mule 3.5

I am using the Mule 3.5 Anypoint connector and have moved from a select request to stored procedures in a batch processing scope component. With this change, the mule does not like the type of object returned by the stored procedure.

Here is the error I am returning:

ERROR 2014-06-26 15:15:00,426 [pool-15-thread-1] org.mule.exception.DefaultMessagingExceptionStrategy: 
********************************************************************************
Message               : Object "java.util.HashMap" 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)
Code                  : MULE_ERROR--2
--------------------------------------------------------------------------------

The type of object returned from the database connector using the stored procedure is as follows:

java.util.HashMap

Using an operator Select(this works) the type is as follows:

org.mule.util.CaseInsensitiveHashMap

As stated above with the select statement, this works.

Additional system information:

  • This is SQL Server 2008 R2
  • The database connector works fine with the stored procedure, but errors when it reaches the process records section

    <batch:job name="ons-esb-mainBatch1">
    <batch:threading-profile poolExhaustedAction="WAIT"/>
    <batch:input>
        <poll doc:name="Poll">
            <fixed-frequency-scheduler frequency="15" timeUnit="SECONDS"/>
            <db:stored-procedure config-ref="Generic_Database_Configuration" doc:name="Database">
                <db:parameterized-query><![CDATA[{ CALL otis.GetEntityQueueByTime() }]]></db:parameterized-query>
            </db:stored-procedure>
        </poll>
        <logger level="INFO" doc:name="Logger"/>
    </batch:input>
    <batch:process-records>
        <batch:step name="Batch_Step">
            <choice doc:name="Choice">
                <!-- Choice Selector Logic -- Taken Out to Save Space --!>
            </choice>
        </batch:step>
    </batch:process-records>
    <batch:on-complete>
        <logger message="EntityQueues Completed Queueing into ActiveMQ" level="INFO" doc:name="Logger"/>
    </batch:on-complete>
    

Summary

, , select.

+4
1

A java.util.HashMap . entrySet():

<batch:input> <poll doc:name="Poll"> <fixed-frequency-scheduler frequency="15" timeUnit="SECONDS"/> <db:stored-procedure config-ref="Generic_Database_Configuration" doc:name="Database"> <db:parameterized-query><![CDATA[{ CALL otis.GetEntityQueueByTime() }]]></db:parameterized-query> </db:stored-procedure> </poll> <set-payload value="#[message.payload.entrySet()]" /> <logger level="INFO" doc:name="Logger"/> </batch:input>

+3

Source: https://habr.com/ru/post/1546191/


All Articles