Mule flow with Jms connector, Threads blocking in dynamic outbound endpoint

时间秒杀一切 提交于 2020-01-06 08:16:16

问题


I have a jms connector, i am receiving message from a queue processing the message in a flow, calling db to get the data based on some ids in the message and writing response output to files, i am using dynamic outbound endpoints to decide output location.

    <jms:connector name="tibco" numberOfConsumers="20" ..... >
                  .....
    </jms:connector>
    <flow name="realtime" doc:name="ServiceId-8">
    <jms:inbound-endpoint queue="${some.queue}" connector-ref="tibco" doc:name="JMS">
       <jms:transaction action="ALWAYS_BEGIN"/>
    </jms:inbound-endpoint>
    <processor ref="proc1"></processor>
    <processor ref="proc2"></processor>
    <component doc:name="Java">
        <spring-object bean="comp1"/>
    </component>
    <processor ref="proc3"></processor>
    <collection-splitter doc:name="Collection Splitter"/>
    <processor ref="endpointprocessor"></processor>
    <foreach collection="#[message.payload.consumerEndpoints]" counterVariableName="endpoints" doc:name="Foreach">

            <when expression="#[consumerEndpoint.getOutputType().equals('txt') and consumerEndpoint.getChannel().equals('file')]">
                <processor-chain>
                    <file:outbound-endpoint path="#[consumerEndpoint.getPath()]" outputPattern="#[consumerEndpoint.getClientId()]-#[attributes['eventId']]%#[consumerEndpoint.getTicSeedCount()]-#[attributes['dateTime']].tic" responseTimeout="10000" doc:name="File"/>
                </processor-chain>  
            </when>
            <when expression="#[consumerEndpoint.getOutputType().equals('txt') and consumerEndpoint.getChannel().equals('ftp')]">
                 <processor-chain>
                    <ftp:outbound-endpoint path="#[consumerEndpoint.getPath()]" outputPattern="#[consumerEndpoint.getClientId()]-#[attributes['eventId']]%#[consumerEndpoint.getTicSeedCount()]-#[attributes['dateTime']].tic" host="#[consumerEndpoint.getHost()]" port="#[consumerEndpoint.getPort()]" user="#[consumerEndpoint.getChannelUser()]" password="#[consumerEndpoint.getChannelPass()]" responseTimeout="10000" doc:name="FTP"/>
                 </processor-chain>
            </when>
         </choice>
    </foreach>
    <rollback-exception-strategy doc:name="Rollback Exception Strategy">
        <processor ref="catchExceptionCustomHandling"></processor>
    </rollback-exception-strategy>
</flow>

Above is not complete flow. i pasted the important parts to understand.

Question 1. As i have not defined any thread strategy at any level, and connector has numberOfConsumers="20", if i drop 20 messages in queue how many threads will start. prefetch size in the jms queue is set to 20.

Question 2: Do i need to configure threading strategy at receiver end and/or at flow level.

some time when the load is very high(let say 15k msgs in queue in a minute) i see message processing gets slow and thread dump shows some thing like below:

"TIBCO EMS Session Dispatcher (7905958)" prio=10 tid=0x00002aaadd4cf000 nid=0x3714 waiting for monitor entry [0x000000004af1e000] java.lang.Thread.State: BLOCKED (on object monitor) at org.mule.endpoint.DynamicOutboundEndpoint.createStaticEndpoint(DynamicOutboundEndpoint.java:153) - waiting to lock <0x00002aaab711c0e0> (a org.mule.endpoint.DynamicOutboundEndpoint)

Any help and pointers will be appreciated.

Thanks-


回答1:


Message processing is getting slow because of dynamic endpoint, I see thread congestion when dynamic outbound endpoint is created and used. I was using mule 3.3.x and after looking at mule 3.4.x code i realized that dynamic outbound endpoint creation is handled more appropriately. upgraded to 3.4 and the issue is almost gone.



来源:https://stackoverflow.com/questions/22702325/mule-flow-with-jms-connector-threads-blocking-in-dynamic-outbound-endpoint

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!