« Return to Thread: [MULE 2] Work caused exception on 'workCompleted'

RE: [MULE 2] Work caused exception on 'workCompleted'

by Enrique Rodríguez :: Rate this Message:

Reply to Author | View in Thread

Hi, here goes a sample config. Hope this helps.

    <!-- mule-config.xml -->
    <tcp:connector name="TcpConnector">
        <receiver-threading-profile doThreading="true"
                                             maxThreadsActive="150"
                                             maxThreadsIdle="50"
                                             poolExhaustedAction="WAIT"
                                             maxBufferSize="100"
                                             threadWaitTimeout="240000"/>
    </tcp:connector>

    <vm:connector name="vmQueue" queueEvents="false">
        <receiver-threading-profile doThreading="true"
                                             maxThreadsActive= "250"
                                             maxThreadsIdle= "250"
                                             poolExhaustedAction="WAIT"
                                             maxBufferSize="100"
                                             threadWaitTimeout="240000"/>
        <dispatcher-threading-profile doThreading="true"
                                                maxThreadsActive= "10"
                                                maxThreadsIdle= "10"
                                                poolExhaustedAction="WAIT"
                                                maxBufferSize="100"
                                                threadWaitTimeout="240000"/>
        <vm:queueProfile maxOutstandingMessages="100"/>
    </vm:connector>
   
    <model name="ServiceBrokerModel">
        <service name="ServiceBroker">
            <inbound>
                <tcp:inbound-endpoint address="tcp://localhost:6853"
                                                remoteSync="true"
                                                transformer-refs="ByteArrayToSerializable"
                                                connector-ref="TcpConnector"/>
                <inbound-endpoint ref="serviceBroker" remoteSync="true"/>
            </inbound>
            <component>
                <!--
                -- This component dispatches messages to a service based on some
                -- properties of the message.
                -->
                <spring-object bean="DispatcherComponent"/>
            </component>
            <outbound>
                <forwarding-catch-all-strategy>
                    <vm:outbound-endpoint ref="serviceBrokerResponse"/>
                </forwarding-catch-all-strategy>
                <static-recipient-list-router>
                    <reply-to address="vm://serviceBrokerResponse"/>
                    <payload-type-filter expectedType="com.abitab.servicebroker.Request"/>
                </static-recipient-list-router>
            </outbound>

            <async-reply timeout="25000">
                <vm:inbound-endpoint path="serviceBrokerResponse"
                                               connector-ref="vmQueue"
                                               transformer-refs="ObjectToResponse"/>
                <single-async-reply-router/>
            </async-reply>
        </service>
    </model>


   
    <!-- SomeService-mule-config.xml -->
    <model name="SomeServiceModel">
        <service name="SomeService_operation">
            <inbound>
                <vm:inbound-endpoint path="SomeService_operation" />
            </inbound>
            <outbound>
                <custom-outbound-router
                                        class="com.abitab.servicebroker.mule.routers.RetryOutboundRouter">
                    <axis:outbound-endpoint address="<...url...>"
                                                      remoteSync="true"
                                                      style="RPC"
                                                      use="ENCODED">
                        <axis:soap-method method="<...method...>">
                            <...axis config...>
                        </axis:soap-method>
                        <transformers>
                            <...transformers...>
                        </transformers>
                        <response-transformers>
                            <...transformers...>
                        </response-transformers>
                    </axis:outbound-endpoint>
                </custom-outbound-router>
            </outbound>
        </service>
    </model>



    // DispatcherComponent.java

    public Object onCall(MuleEventContext eventContext) {
        Request request = (Request)eventContext.transformMessage();

        List recipients = new ArrayList();

        recipients.add("vm://" + request.getServiceId() + "_" + request.getOperationId());

        eventContext.getMessage().setProperty("recipients", recipients);

        return request;
    }

 « Return to Thread: [MULE 2] Work caused exception on 'workCompleted'