所有消息都没有从Mule应用程序中的ActiveMQ中出列

时间:2013-02-04 23:42:07

标签: activemq mule

我在Mule应用程序中有一个带有两个JMS连接器的登台队列,用于读取和写入队列。如果我在队列中暂存/排队40条消息,则只有20条消息正在出列,其余的消息将作为待处理消息进行处理,并且在Mule App未重新启动之前不会出列。

以下是连接器和骡子流的代码。谁能提出问题可能在这里?以及为什么消息处理在20条消息处停止。

如果需要更多信息,请与我们联系。

<!-- PROCESSING BEAN WHICH HAS ALL STREAM INTERACTION AND ERROR HANDLING -->
        <spring:bean name="processorPR" class="net.prcins.esb.claims.vci.policereports.processing.PoliceReportProcessor" scope="prototype">
            <spring:property name="policeReportBO" ref="policeReportBO" />
        </spring:bean>

        <!-- This is for validation of inital transformation -->    
        <spring:bean name="receiverPR" class="net.prcins.esb.claims.vci.policereports.staging.PoliceReportReceiver" scope="prototype" />            


        <!-- PROCESSING BEAN WHICH HAS ALL BUSINESS LOGIC -->
        <spring:bean name="policeReportBO" class="net.prcins.esb.claims.vci.policereports.processing.PoliceReportBO" scope="prototype">     
            <spring:property name="rulesFileCovLogic_NE" value="${policeReport.rules.covLogic.NE}"/>
            <spring:property name="rulesFileCovLogic_NJ" value="${policeReport.rules.covLogic.NJ}"/>                        
        </spring:bean>



<jms:activemq-connector name="jmsConnectorStagingQReaderNormal"
                            brokerURL="${mule.activemq.broker.read.normal.url}" 
                            specification="1.1"
                            maxRedelivery="-1"
                            persistentDelivery="true"   
                            createMultipleTransactedReceivers="true"
                            numberOfConcurrentTransactedReceivers="10"        
                            connectionFactory-ref="connectionFactoryPR"
                            disableTemporaryReplyToDestinations="false">
        </jms:activemq-connector>


        <!-- JMS CONNECTOR FOR WRITING FROM STAGING QUEUE -->
        <jms:activemq-connector name="jmsConnectorStagingQWriter"
                            brokerURL="${mule.activemq.broker.write.url}" 
                            specification="1.1"
                            maxRedelivery="-1"
                            persistentDelivery="true"
                           createMultipleTransactedReceivers="true"
                            numberOfConcurrentTransactedReceivers="10" 
                            connectionFactory-ref="connectionFactoryPR"
                            disableTemporaryReplyToDestinations="false">
        </jms:activemq-connector>

    <jms:endpoint name="inboundProcessReaderNormalPR" queue="${policereport.queue.staging.name}" exchange-pattern="one-way" connector-ref="jmsConnectorStagingQReaderNormal" />


<flow name="pr-flow-stage-individual-message">
        <http:inbound-endpoint  host=   "localhost" 
                                    port=   "${policeReport.inbound.port}" 
                                    path=   "claims/vci/policeReport/record"
                                    exchange-pattern=   "request-response"
                                    >

         </http:inbound-endpoint>
         <object-to-string-transformer />
        <logger message="PoliceRecord: SPLIT MESSAGE:#[payload]" level="ERROR" /> 
        <transformer ref="XMLToRecord"></transformer>

        <!--  COMPONENT TO PROCESS THE DATA -->
        <!-- Component returns Invoice XML if all validations are successful, else it returns error XML containing error message, error code and original payload -->
        <component>
            <spring-object bean="receiverPR"></spring-object>
        </component>
        <transformer ref="RecordToXML"></transformer>
        <object-to-string-transformer />
        <!-- DECIDE SUCCESS/FAILURE AND PLACE ON QUEUE IF SUCCESS --> 
         <choice>
               <when expression="//Record/Response/Status = 'ACCEPTED'" evaluator="xpath">
                <jms:outbound-endpoint  ref="inboundProcessReaderNormalPR" doc:name="JMS">
                            <jms:transaction action="NONE"/>
                </jms:outbound-endpoint>
            </when>
            <otherwise>
                <!-- Relevant endpoint for error handling -->
                <logger message="Skipped staging message due to errors" level="ERROR" /> 
            </otherwise>
         </choice>

        <logger message="PoliceReport: STAGED PAYLOAD:#[payload]" level="ERROR" />

      <default-exception-strategy>
            <logger message="PoliceReport: Exception recived in flow-stage-individual-message. Payload is :#[payload]" level="ERROR" />
      </default-exception-strategy>

    </flow>

    <!-- ============================== PROCESSING =============================== -->
     <!-- ====================================================================== -->
    <!--===================  PROCESSING JOB FOR Police Report (NORMAL)  ========================-->
        <flow name="pr-flow-process-jms-input-normal" > 
          <jms:inbound-endpoint    ref="inboundProcessReaderNormalPR"/> 
          <flow-ref name="pr-flow-process-jms-input-subbflow" />
        </flow>

        <!--===================  PROCESSING JOB FOR Police Report (DR)  ========================-->

        <flow name="pr-flow-process-jms-input-dr" > 
          <jms:inbound-endpoint ref="inboundProcessReaderDRPR" /> 
        <flow-ref name="pr-flow-process-jms-input-subbflow" />
        </flow>

        <!--===================  PROCESSING JOB FOR PoliceReport (NE)  ========================-->
       <sub-flow name="pr-flow-process-jms-input-subbflow" > 

        <transformer  ref="DomToXmlPR" doc:name="DOM to XML"/>    
        <transformer ref="XMLToRecord"></transformer>

          <!--  COMPONENT TO PROCESS THE DATA. WILL PROCESS THE OBJECT AND RETURN ANOTHER OBJECT AS RESPONSE -->
        <component> 
            <spring-object bean="processorPR"></spring-object>
        </component>

        <!--  Component above performs all business logic, including validations, creation/editing of claim, error handling etc. 
        Returns success/failure of claim import processing in the end -->

        <transformer ref="RecordToXML"></transformer>
        <object-to-string-transformer />

        <!-- DECIDE SUCCESS OR FAILURE  -->
        <choice>
              <when expression="//Record/Response/Status = 'ERROR' and contains(//Record/Response/Description, 'SysError')" evaluator="xpath">
             <!-- DROP XFORMED BATCH FORMAT STRING ON THE JMS QUEUE
                RETURNS RIGHT AWAY, NO WAITING -->
                <logger message="PoliceReport: FAILED TO PROCESS MESSAGE :#[payload]" level="ERROR" />
                <jms:outbound-endpoint queue="${policeReport.queue.errors.name}" exchange-pattern="one-way" connector-ref="policeReportJMSConnectorErrorQWriter" />
            </when>
             <otherwise>
                     <logger message="Messages processd without error :#[payload]" level="ERROR" />
             </otherwise>
        </choice>
        <transformer ref="record2balancingXFormer" />
        <object-to-string-transformer />
        <splitter evaluator="xpath" expression="//Batch_Status"  />
        <!-- <logger message="OUTPUT OF SPLITTER IS: #[payload]" level="ERROR" /> --> 
        <custom-transformer class="net.prcins.esb.claims.vci.policereports.transformers.DocumentToString" />
        <!--  Not sure why only splitter makes the payload workable for HTTP call. Without this, I keep getting error that the Rest Endpoint does not accept XML -->
        <flow-ref name="pr-flow-balancing"/>

      </sub-flow>

1 个答案:

答案 0 :(得分:0)

不确定发生了什么,但有些事情可能会在配置中引入不必要的线程/争用,让我有点担心:

  • 如果可用实例少于并发线程,pooled-component可能会成为瓶颈。您确定真的需要pooled-component吗?使用它们而不是标准component的理由是什么?
  • flow-process-jms-input-subbflow是私有流,而不是子流,并使用默认处理策略。这意味着flow-ref中的flow-process-jms-input-normal调用实际上会将执行转移到另一个线程。除非真的你想要发生什么,否则我建议你将flow-process-jms-input-subbflow变成一个子流,这样它就会在{{{}中收到JMS消息的同一个线程上执行。 1}}。
  • 引用<jms:inbound-endpoint ref="inboundProcessReaderNormal" />中的全局端点inboundProcessReaderNormal,而不是重新定义它。

这些变化很可能无法解决问题,但至少会简化执行模式,并有助于更好地推断正在发生的事情。