Error BlockingMessageSender of message processor in WSO2 - proxy

I'm trying to use the message forwarding processor in WSO2 (4.8.1).
The context is the follow:
1) I've my messages in a Message Store
2) I use my message forwarding processor to extract messages from the store and invoke a wso2 proxy
3) my proxy invoke an external service
I'm testing the SOAP Fault of my external service.
Here you are my code
My message forwarding processor configuration is the following
<?xml version="1.0" encoding="UTF-8"?><messageProcessor xmlns="http://ws.apache.org/ns/synapse" class="org.apache.synapse.message.processor.impl.forwarder.ScheduledMessageForwardingProcessor" name="AnotherCapForwardMessageProcessor" targetEndpoint="AnotherCapProxyEndPoint" messageStore="OperCupIDStore">
<parameter name="message.processor.reply.sequence">AnotherCapProcessorReply</parameter>
<parameter name="max.delivery.attempts">2</parameter>
<parameter name="client.retry.interval">5000</parameter>
<parameter name="interval">5000</parameter>
<parameter name="message.processor.fault.sequence">AnotherCapProcessorFault</parameter>
<parameter name="is.active">true</parameter>
and my proxy is the following
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="AnotherCapProxy" transports="http https" startOnLoad="true" trace="disable">
<target>
<inSequence>
<log level="custom">
<property name="where" value="********** [ANOTHER-CAP-PROXY] - BEGINNING OF IN SEQUENCE .... "/>
</log>
<log level="full">
<property name="what" value="********** [ANOTHER-CAP-PROXY] - MESSAGE FROM OPERCUPIDSTORE...."/>
</log>
<property name="FORCE_ERROR_ON_SOAP_FAULT" value="false" scope="default" type="STRING"/>
<property name="OUT_ONLY" value="false" scope="default" type="STRING"/>
<property name="InternalCodErr" value="WSO2_xxx" scope="default" type="STRING"/>
<property xmlns:ns="http://org.apache.synapse/xsd" xmlns:p="http://gamopera.ifpl.csi.it" name="ProcessingID" expression="//p:id" scope="default" type="STRING"/>
<log level="custom">
<property xmlns:ns="http://org.apache.synapse/xsd" name="what" expression="fn:concat('****[ANOTHER-CAP-PROXY] - PROCESSING ID: ',get-property('default','ProcessingID'))"/>
</log>
<xslt xmlns:ns="http://org.apache.synapse/xsd" key="gov:xslt/getInputCUPXml_Transform.xslt" source="$body">
<property name="idOp" expression="get-property('default','ProcessingID')"/>
</xslt>
<log level="full">
<property name="what" value="********** [ANOTHER-CAP-PROXY] - CALLING GAMOPERA FOR THE XML REQUEST TO INVOKE SIMON.... "/>
</log>
<header name="Action" scope="default" value=" "/>
<send>
<endpoint key="AnotherCapGamoperaCreateXMLServiceEndpoint"/>
</send>
</inSequence>
<outSequence>
<log level="full">
<property name="where" value="********** [ANOTHER-CAP-PROXY] - BEGINNING OF OUT SEQUENCE .... "/>
<property name="where" value="********** [ANOTHER-CAP-PROXY] - THE GAMOPERA RESPONSE ...."/>
</log>
<filter xmlns:s12="http://www.w3.org/2003/05/soap-envelope" xmlns:ns="http://org.apache.synapse/xsd" xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/" xpath="s11:Body/s11:Fault | s12:Body/s12:Fault">
<then>
<property name="ErrorCode" value="WSO2_004" scope="operation" type="STRING"/>
<log level="custom">
<property name="where" value="********** [ANOTHER-CAP-PROXY] - SOAP FAULT !!! SOMETHING WENT WRONG CALLING GAMOPERA IN GETTING XML ...."/>
<property name="ERROR_CODE" expression="get-property('operation','ErrorCode')"/>
</log>
</then>
<else>
<property name="ErrorCode" value="WSO2_003" scope="default" type="STRING"/>
<log level="custom">
<property name="where" value="********** [ANOTHER-CAP-PROXY] - NOT COMPLETE RESPONSE FROM GAMOPERA IN GETTING XML ..."/>
<property name="ERROR_CODE = " expression="get-property('default','ErrorCode')"/>
</log>
</else>
</filter>
<send/>
</outSequence>
<faultSequence>
<log level="full">
<property name="where" value="********** [ANOTHER-CAP-PROXY] - BEGINNING OF FAULT SEQUENCE .... "/>
<property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
<property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
<property name="ERROR_DETAIL" expression="get-property('ERROR_DETAIL')"/>
<property name="ERROR_EXCEPTION" expression="get-property('ERROR_EXCEPTION')"/>
</log>
<send/>
</faultSequence>
</target>
<publishWSDL key="gov:wsdl/AnotherWSDL.wsdl"/>
So my message processor try two times, then deactive itself.
When execute the log is the follow ...
TID: [0] [ESB] [2014-10-31 11:00:17,128] INFO {org.apache.synapse.mediators.builtin.LogMediator} - where = ********** [ANOTHER-CAP-PROXY] - BEGINNING OF IN SEQUENCE .... {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-10-31 11:00:17,128] INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: /wso003/services/AnotherCapProxy, WSAction: urn:process, SOAPAction: urn:process, MessageID: urn:uuid:2262a521-97da-471a-8691-da9016cbeac3, Direction: request, what = ********** [ANOTHER-CAP-PROXY] - MESSAGE FROM OPERCUPIDSTORE...., Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body>
<gam:process xmlns:gam="http://gamopera.ifpl.csi.it">
<!--Zero or more repetitions:-->
<gam:id>459</gam:id></gam:process>
</soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-10-31 11:00:17,129] INFO {org.apache.synapse.mediators.builtin.LogMediator} - what = ****[ANOTHER-CAP-PROXY] - PROCESSING ID: 459 {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-10-31 11:00:17,132] INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: /wso003/services/AnotherCapProxy, WSAction: urn:process, SOAPAction: urn:process, MessageID: urn:uuid:2262a521-97da-471a-8691-da9016cbeac3, Direction: request, what = ********** [ANOTHER-CAP-PROXY] - CALLING GAMOPERA FOR THE XML REQUEST TO INVOKE SIMON.... , Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body>
<p:gestWso2GetInputCUPXml xmlns:p="http://operintegrated.interfacews.operserv.gamopera.csi.it/"><input><idOperazione>459</idOperazione></input></p:gestWso2GetInputCUPXml></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-10-31 11:00:18,980] INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:bf5762a3-2324-4fed-8b56-fdc7cdd4cac2, Direction: response, where = ********** [ANOTHER-CAP-PROXY] - BEGINNING OF OUT SEQUENCE .... , where = ********** [ANOTHER-CAP-PROXY] - THE GAMOPERA RESPONSE ...., Envelope: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Errore imprevisto occorso durante l'esecuzione del metodo:java.lang.NullPointerException</faultstring><detail><ns1:Exception xmlns:ns1="http://operintegrated.interfacews.operserv.gamopera.csi.it/"></ns1:Exception></detail></soap:Fault></soap:Body></soap:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-10-31 11:00:18,980] INFO {org.apache.synapse.mediators.builtin.LogMediator} - where = ********** [ANOTHER-CAP-PROXY] - FAULT !!! SOMETHING WENT WRONG CALLING GAMOPERA IN GETTING XML ...., ERROR_CODE = WSO2_004 {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-10-31 11:00:18,985] ERROR {org.apache.synapse.message.processor.impl.forwarder.ForwardingService} - BlockingMessageSender of message processor [AnotherCapForwardMessageProcessor] failed to send message to the endpoint {org.apache.synapse.message.processor.impl.forwarder.ForwardingService}
TID: [0] [ESB] [2014-10-31 11:00:18,986] INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: /wso003/services/OperCupPrepareProxy.OperCupPrepareProxyHttpSoap11Endpoint, WSAction: urn:process, SOAPAction: urn:process, MessageID: urn:uuid:4ECFA324C9FBB675AB842060829710186-582880576, Direction: request, where = ********** [ANOTHER-CAP-PROCESSOR-FAULT] - BEGINNING PROCESSOR FAULT SEQUENCE .... , Envelope: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Errore imprevisto occorso durante l'esecuzione del metodo:java.lang.NullPointerException</faultstring><detail><ns1:Exception xmlns:ns1="http://operintegrated.interfacews.operserv.gamopera.csi.it/"></ns1:Exception></detail></soap:Fault></soap:Body></soap:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-10-31 11:00:18,992] INFO {org.apache.synapse.message.processor.impl.ScheduledMessageProcessor} - Successfully deactivated the message processor [AnotherCapForwardMessageProcessor] {org.apache.synapse.message.processor.impl.ScheduledMessageProcessor}
I see that the execution doesn't cross in the message processor retry sequence and probably something goes wrong when i close the proxy out sequence.
Any suggestion? Thank you very much in advance!!!
Bye
Cesare

When you send back the soap fault to the message processor in your proxy outSequence, the message processor execute it's fault sequence : HTTP Status code of your message must have a value different from '500'. You should log it (use property $axis2:HTTP_SC)
When the fault sequence is executed 'max.delivery.attempts' times, the message processor is deactivated, if you want it to redeliver the message indefinitely, set this value to -1

Related

Error occurred in the mediation of the class mediator WSO2 ESB

I used wso2 esb 5.0 for create proxy services. I created proxy service using class mediator. Below is the java class.
public class CalculatePaymentAmount extends AbstractMediator {
public boolean mediate(MessageContext messageContext) {
String noOfMonths = messageContext.getEnvelope().getBody().getFirstElement().
getFirstChildWithName(new QName("noOfMonths")).getText();
String InsuranceRate = messageContext.getEnvelope().getBody().getFirstElement().
getFirstChildWithName(new QName("InsuranceRate")).getText();
DecimalFormat decimalFormat = new DecimalFormat("#.##");
double totalAmount = Double.parseDouble(noOfMonths) * Double.parseDouble(InsuranceRate);
messageContext.setProperty("noOfMonths", noOfMonths);
messageContext.setProperty("paymentAmount", decimalFormat.format(totalAmount));
return true;
}
public String getType() {
return null;
}
public void setTraceState(int traceState) {
traceState = 0;
}
public int getTraceState() {
return 0;
}
}
I created the proxy service using class mediator. Below define the proxy code.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="PaymentAmountProxy"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http,https">
<target>
<inSequence>
<log/>
<class name="com.mediator.java.CalculatePaymentAmount"/>
<property expression="get-property('default','noOfMonths')"
name="getNoOfMonths"
scope="default"
type="STRING"/>
<property expression="get-property('default','paymentAmount')"
name="getPaymentAmount"
scope="default"
type="STRING"/>
<log>
<property expression="get-property('default','getNoOfMonths')"
name="No.Of Months:"/>
<property expression="get-property('default','getPaymentAmount')"
name="Paymrent Amount:"/>
</log>
</inSequence>
</target>
<description/>
</proxy>
This one working fine and gave expected response.
But when I use this class mediator with other mediators, it getting errors when I invoked the proxy service.
Below mentioned the proxy service that I used with class mediator.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="LatestLicenseRenewalSystem"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http,https">
<target>
<inSequence>
<log/>
<property expression="get-property('transport','VehicleNo')"
name="vehicleNo"
scope="default"
type="STRING"/>
<log>
<property expression="get-property('default','vehicleNo')" name="VehicleNo"/>
</log>
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsa="http://www.w3.org/2005/08/addressing"
xmlns:sam="http://sample.esb.org">
<soapenv:Header/>
<soapenv:Body>
<sam:getPolicyID>
<sam:vehicleNumber>$1</sam:vehicleNumber>
</sam:getPolicyID>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg evaluator="xml" expression="get-property('default','vehicleNo')"/>
</args>
</payloadFactory>
<log level="full"/>
<header name="Action" scope="default" value="urn:getCertificateID"/>
<call>
<endpoint>
<address format="soap12"
uri="http://172.17.0.1:9763/services/EmissionTestService.EmissionTestServiceHttpSoap12Endpoint/">
<enableAddressing/>
</address>
</endpoint>
</call>
<log level="full"/>
<property xmlns:ns="http://sample.esb.org"
expression="//ns:getCertificateIDResponse/ns:return"
name="certificateID"
scope="default"
type="STRING"/>
<log>
<property expression="get-property('default','certificateID')"
name="CertificateID"/>
</log>
<class name="com.mediator.java.CalculatePaymentAmount"/>
<property expression="get-property('default','noOfMonths')"
name="getNoOfMonths"
scope="default"
type="STRING"/>
<property expression="get-property('default','paymentAmount')"
name="getPaymentAmount"
scope="default"
type="STRING"/>
<log>
<property expression="get-property('default','getNoOfMonths')"
name="No.Of Months:"/>
<property expression="get-property('default','getPaymentAmount')"
name="Paymrent Amount:"/>
</log>
<respond/>
</inSequence>
</target>
<description/>
</proxy>
Below error is occurred when invoking the above proxy service.
LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: urn:getCertificateIDResponse, SOAPAction: urn:getCertificateIDResponse, ReplyTo: http://www.w3.org/2005/08/addressing/anonymous, MessageID: urn:uuid:6f4557eb-b8ff-4c19-bbe8-4c7e929d8386, Direction: request, MESSAGE = Executing default 'fault' sequence, ERROR_CODE = 0, ERROR_MESSAGE = Error occured in the mediation of the class mediator, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsa:Action>urn:getCertificateIDResponse</wsa:Action><wsa:RelatesTo>urn:uuid:6f4557eb-b8ff-4c19-bbe8-4c7e929d8386</wsa:RelatesTo></soapenv:Header><soapenv:Body><ns:getCertificateIDResponse xmlns:ns="http://sample.esb.org"><ns:return>-1250719063</ns:return></ns:getCertificateIDResponse></soapenv:Body></soapenv:Envelope>
Can anyone help me to solve this. Any help or workarounds are really appreciated.
Your class mediator is accessing the elements 'noOfMonths' and 'InsuranceRate' from the message context. But according to the error log, the message context is having a different soap envelope which does not have the above elements.
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsa:Action>urn:getCertificateIDResponse</wsa:Action><wsa:RelatesTo>urn:uuid:6f4557eb-b8ff-4c19-bbe8-4c7e929d8386</wsa:RelatesTo></soapenv:Header><soapenv:Body><ns:getCertificateIDResponse xmlns:ns="http://sample.esb.org"><ns:return>-1250719063</ns:return></ns:getCertificateIDResponse></soapenv:Body></soapenv:Envelope>
This must me the response received from the call operation before the class mediator.
You have to either isolate the class mediator from the call operation and use different proxy services or move the class mediator above the payload factory.
For solve this issue, use payloadFactory mediator before the class mediator and set the parameters for the payload. I mentioned below the code.
<payloadFactory media-type="xml">
<format>
<paymentDetails xmlns="">
<noOfMonths>$1</noOfMonths>
<InsuranceRate>$2</InsuranceRate>
</paymentDetails>
</format>
<args>
<arg evaluator="xml" expression="get-property('default','noOfMonths')"/>
<arg evaluator="xml" expression="get-property('default','InsuranceRate')"/>
</args>
</payloadFactory>
<class name="com.mediator.java.CalculatePaymentAmount"/>

Spring-integration-ftp polls file even when my application is stopped

As a follow up to the question -
Same file gets picked up again and again in spring-ftp but with different names
I have the following configuration in my application.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:int="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:file="http://www.springframework.org/schema/integration/file"
xmlns:int-stream="http://www.springframework.org/schema/integration/stream"
xmlns:int-ftp="http://www.springframework.org/schema/integration/ftp"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/file
http://www.springframework.org/schema/integration/file/spring-integration-file.xsd
http://www.springframework.org/schema/integration/stream
http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd
http://www.springframework.org/schema/integration/ftp
http://www.springframework.org/schema/integration/ftp/spring-integration-ftp.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<int:poller id="poller" task-executor="synchTaskExecutor" default="true" fixed-delay="1000" />
<beans:bean id="ftpClientFactory"
class="com.everge.springframework.integration.ftp.session.EvergeFtpSessionFactory">
<beans:property name="host" value="111.93.128.170"/>
<beans:property name="port" value="21"/>
<beans:property name="username" value="singha"/>
<beans:property name="password" value="singha16"/>
<beans:property name="clientMode" value="2"></beans:property>
</beans:bean>
<beans:bean id="ftpOutClientFactory"
class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory">
<beans:property name="host" value="111.93.128.170"/>
<beans:property name="port" value="21"/>
<beans:property name="username" value="singha"/>
<beans:property name="password" value="singha16"/>
<beans:property name="clientMode" value="2"></beans:property>
</beans:bean>
<beans:bean id="synchTaskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<beans:property name="corePoolSize" value="1"></beans:property>
<beans:property name="maxPoolSize" value="1"></beans:property>
<beans:property name="queueCapacity" value="1"></beans:property>
</beans:bean>
<beans:bean id="pqqFtpClientFactory"
class="com.everge.springframework.integration.ftp.session.PqqEvergeFtpSessionFactory">
<beans:property name="host" value="111.93.128.170"/>
<beans:property name="port" value="21"/>
<beans:property name="username" value="singha"/>
<beans:property name="password" value="singha16"/>
<beans:property name="clientMode" value="2"></beans:property>
</beans:bean>
<int:channel id="ftpChannel">
<int:queue/>
</int:channel>
<beans:bean id="acceptAllFileListFilter" class="com.everge.file.processing.EvergeFileListFilter"/>
<beans:bean id="pqqHandler" class="com.everge.pqq.PqqFileHandler">
<beans:property name="config" ref="baseConfig"></beans:property>
</beans:bean>
<beans:bean id="handler" scope="prototype" class="com.everge.integration.client.FileHandler">
<beans:property name="config" ref="baseConfig"></beans:property>
</beans:bean>
<beans:bean id="baseConfig" class="com.everge.config.BaseConfig" />
<beans:bean id="ftpSplitter" class="com.everge.service.FtpSplitter" />
<beans:bean id="fileSplitter" class="com.everge.file.processing.FileSplitter" />
<int-ftp:outbound-channel-adapter id="notifFtpOutBound"
channel="pl"
remote-directory="/ADPWG/PRCSD1"
session-factory="ftpOutClientFactory" auto-startup="true">
<int-ftp:request-handler-advice-chain>
<int:retry-advice />
</int-ftp:request-handler-advice-chain>
</int-ftp:outbound-channel-adapter>
<int-ftp:outbound-channel-adapter id="ftpOutbound"
channel="pqqOutputFileChannel"
remote-directory="/ADPWG/PRCSD"
session-factory="ftpOutClientFactory" auto-startup="true">
<int-ftp:request-handler-advice-chain>
<int:retry-advice />
</int-ftp:request-handler-advice-chain>
</int-ftp:outbound-channel-adapter>
<file:inbound-channel-adapter prevent-duplicates="false" id="filesIn1" directory="file:/Users/abhisheksingh/ddrive/everge_ws/f" auto-startup="true">
<int:poller id="poller" task-executor="synchTaskExecutor" fixed-delay="1000"></int:poller>
</file:inbound-channel-adapter>
<int:service-activator input-channel="filesIn1" ref="handler" />
<file:inbound-channel-adapter prevent-duplicates="false" id="pqqInputFileChannel" directory="file:/Users/abhisheksingh/ddrive/everge_ws/pqqReq" auto-startup="true">
<int:poller id="poller" task-executor="synchTaskExecutor" fixed-delay="1000" />
</file:inbound-channel-adapter>
<int:service-activator input-channel="pqqInputFileChannel" ref="pqqHandler" />
<file:inbound-channel-adapter id="pqqOutputFileChannel" directory="/Users/abhisheksingh/ddrive/everge_ws/pqqResp">
<int:poller id="poller" task-executor="synchTaskExecutor" fixed-delay="10000" />
</file:inbound-channel-adapter>
<int-ftp:inbound-channel-adapter id="ftpInbound"
channel="ftpChannel"
session-factory="ftpClientFactory"
auto-create-local-directory="true"
delete-remote-files="false"
local-filter="acceptAllFileListFilter"
local-directory="file:/Users/abhisheksingh/ddrive/everge_ws/f" auto-startup="true" >
<int:poller id="poller" task-executor="synchTaskExecutor" fixed-delay="1000" />
</int-ftp:inbound-channel-adapter>
<int-ftp:inbound-channel-adapter id="pqqFtpInbound"
channel="ftpChannel"
session-factory="pqqFtpClientFactory"
auto-create-local-directory="true"
delete-remote-files="false"
local-filter="acceptAllFileListFilter"
local-directory="file:/Users/abhisheksingh/ddrive/everge_ws/pqqReq" auto-startup="true" >
<int:poller id="poller" task-executor="synchTaskExecutor" fixed-delay="1000" />
</int-ftp:inbound-channel-adapter>
<file:inbound-channel-adapter id="pl" directory="file:/Users/abhisheksingh/ddrive/everge_ws/notifFile" auto-startup="true">
<int:poller id="poller" task-executor="synchTaskExecutor" fixed-delay="1000" />
</file:inbound-channel-adapter>
</beans:beans>
So there is a ftp location which I poll and the polled file gets placed at the following directory on my local machine-
/Users/abhisheksingh/ddrive/test/f
Now sometimes because I found a bug and have to fix it, I stop the tomcat server. I delete the files from my local so that next time I start my server , the same file can be polled again. But I find that the same file gets polled again. My server is stopped! This should not happen as far as I know. Thats why I have posted my application.xml to know if there is something here which keeps the threads hanging. Or is it that the spring-integration-ftp starts a daemon thread which does not depend on the application. Please let me solve this riddle.
I see the following exception in the tomcat logs -
Feb 17, 2017 11:49:24 PM org.apache.catalina.loader.WebappClassLoaderBase loadClass
INFO: Illegal access: this web application instance has been stopped already. Could not load UNIX Type: L8. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1777)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory.createFileEntryParser(DefaultFTPFileEntryParserFactory.java:88)
at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2263)
at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2046)
at org.springframework.integration.ftp.session.FtpSession.list(FtpSession.java:70)
at org.springframework.integration.ftp.session.FtpSession.list(FtpSession.java:43)
at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer$1.doInSession(AbstractInboundFileSynchronizer.java:236)
at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer$1.doInSession(AbstractInboundFileSynchronizer.java:232)
at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:435)
at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer.synchronizeToLocalDirectory(AbstractInboundFileSynchronizer.java:232)
at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource.doReceive(AbstractInboundFileSynchronizingMessageSource.java:193)
at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource.doReceive(AbstractInboundFileSynchronizingMessageSource.java:59)
at org.springframework.integration.endpoint.AbstractMessageSource.receive(AbstractMessageSource.java:134)
at org.springframework.integration.endpoint.SourcePollingChannelAdapter.receiveMessage(SourcePollingChannelAdapter.java:224)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:245)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.access$000(AbstractPollingEndpoint.java:58)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:190)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:186)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:353)
at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:55)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:51)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:344)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
I am pretty much sure at this point that the spring-integration ftp poller does not let the tomcat stop properly.
I did investigate more using jvisualvm. I see that there are task-scheduler threads started which do not close with ./shutdown.sh call to stop the tomcat.
Interesting thing to observe is that if I remove either of the pl or pqqOutputFileChannel adapter, these schedulers dont get created.
Here is the structure of my ear file -
Following is the log which keeps on rolling in the log file even when
shutdown has been called on the tomcat -
541576 DEBUG o.s.i.c.PublishSubscribeChannel - postSend (sent=true) on
channel 'errorChannel', message: ErrorMessage
[payload=org.springframework.core.task.TaskRejectedException: Executor
[java.util.concurrent.ThreadPoolExecutor#6d6033da[Running, pool size =
1, active threads = 0, queued tasks = 0, completed tasks = 1114]] did
not accept task:
org.springframework.integration.util.ErrorHandlingTaskExecutor$1#570e117d,
headers={id=71d77a8b-17ea-7011-3cb3-ddbf7591321f,
timestamp=1487870801603}] 541575 DEBUG o.s.i.c.PublishSubscribeChannel
- postSend (sent=true) on channel 'errorChannel', message: ErrorMessage
[payload=org.springframework.core.task.TaskRejectedException: Executor
[java.util.concurrent.ThreadPoolExecutor#6d6033da[Running, pool size =
1, active threads = 0, queued tasks = 1, completed tasks = 1113]] did
not accept task:
org.springframework.integration.util.ErrorHandlingTaskExecutor$1#44210f79,
headers={id=74a26d65-4b42-da1f-cdf1-b77fea8bfdb7,
timestamp=1487870801603}] 541576 ERROR o.s.i.handler.LoggingHandler -
org.springframework.core.task.TaskRejectedException: Executor
[java.util.concurrent.ThreadPoolExecutor#6d6033da[Running, pool size =
1, active threads = 0, queued tasks = 1, completed tasks = 1113]] did
not accept task:
org.springframework.integration.util.ErrorHandlingTaskExecutor$1#7d7cc2a4
at
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor.execute(ThreadPoolTaskExecutor.java:296)
at
org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:51)
at
org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:344)
at
org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at
org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266) at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745) Caused by:
java.util.concurrent.RejectedExecutionException: Task
org.springframework.integration.util.ErrorHandlingTaskExecutor$1#7d7cc2a4
rejected from
java.util.concurrent.ThreadPoolExecutor#6d6033da[Running, pool size =
1, active threads = 0, queued tasks = 1, completed tasks = 1113] at
java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2047)
at
java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:823)
at
java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1369)
at
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor.execute(ThreadPoolTaskExecutor.java:293)
... 11 more
**541576 DEBUG o.s.i.c.PublishSubscribeChannel - postSend (sent=true) on channel 'errorChannel', message: ErrorMessage
[payload=org.springframework.core.task.TaskRejectedException: Executor
[java.util.concurrent.ThreadPoolExecutor#6d6033da[Running, pool size =
1, active threads = 0, queued tasks = 1, completed tasks = 1113]] did
not accept task:
org.springframework.integration.util.ErrorHandlingTaskExecutor$1#7d7cc2a4,
headers={id=26e6de67-2b70-cd7d-0c64-d21e1f8d1726,
timestamp=1487870801603}] 541611 DEBUG
c.e.s.i.f.s.PqqEvergeFtpSessionFactory - Connected to server
[111.93.128.170:21] 541638 INFO
c.e.s.i.f.s.PqqEvergeFtpSessionFactory - Inside
postProcessClientAfterConnect of PqqEvergeFtpSessionFactory 541778
INFO o.s.i.ftp.session.FtpSession - File has been successfully
transferred from: TEST4.PQQ 541778 DEBUG
o.s.i.f.i.FtpInboundFileSynchronizer - 1 files transferred 541779 INFO
c.e.f.p.EvergeFileListFilter - Check if the file has already been
processed /Users/abhisheksingh/ddrive/everge_ws/pqqArchive/TEST4.PQQ
541779 INFO c.e.f.p.EvergeFileListFilter - Archive file name is
541779 INFO c.e.f.p.EvergeFileListFilter - Input file name is TEST4
541779 INFO c.e.f.p.EvergeFileListFilter - Archive file name is TEST4
541779 INFO c.e.f.p.EvergeFileListFilter - Input file name is TEST4
541779 INFO c.e.f.p.EvergeFileListFilter - The file is already
processed TEST4 541779 ERROR c.e.f.p.EvergeFileListFilter - PQQ file
has already been processed. 541779 DEBUG
o.s.i.e.SourcePollingChannelAdapter - Received no Message during the
poll, returning 'false' 541974 DEBUG
o.s.i.e.SourcePollingChannelAdapter - Received no Message during the
poll, returning 'false'

Search a user in multiple systems through WSO2 ESB proxy

I need to send just one request (can be a proxy url) which takes user id as input and call multiple endpoints and return the response after aggregating all of them.
Currently I am using a proxy service implementation to achieve it but is returns just one response(can be from any of the endpoints) and not able to combine responses from other systems/endpoints. Though I can see the response from another endpoint in my server console.
Below is the code I implemented so far:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="ProxyTestTwoW"
transports="http,https"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log/>
<clone>
<target>
<sequence>
<property name="Application" value="Application1"/>
<property name="messageType"
value="application/xacml+json"
scope="axis2"
type="STRING"/>
<property name="Authorization"
expression="fn:concat('Basic ', base64Encode('username:password'))"
scope="transport"/>
<send>
<endpoint>
<address uri="localhost:8080/iiq/rest/identities/9000070"/>
</endpoint>
</send>
</sequence>
</target>
<target>
<sequence>
<property name="Application" value="Application2"/>
<property name="messageType"
value="application/xacml+json"
scope="axis2"
type="STRING"/>
<property name="Authorization"
expression="fn:concat('Basic ', base64Encode('username:password'))"
scope="transport"/>
<send>
<endpoint>
<address uri="http://localhost:8080/iiq/rest/identities/9000071"/>
</endpoint>
</send>
</sequence>
</target>
</clone>
</inSequence>
<outSequence>
<log level="full" description="">
<property name="Component" expression="get-property('Application')"/>
</log>
<aggregate>
<completeCondition>
<messageCount min="2"/>
</completeCondition>
<onComplete expression="$body/*[1]">
<property name="messageType"
value="application/xacml+json"
scope="axis2"
type="STRING"
description="messageType"/>
<send/>
</onComplete>
</aggregate>
</outSequence>
<faultSequence>
<log level="full" category="WARN"/>
</faultSequence>
</target>
<description/>
</proxy>
Result :
After hitting proxy URL in browser: - Only one response as below:
<jsonObject><viewableIdentityAttributes><Email>Kevin.Mollo#companyb.com</Email><cn>Kevin Mollo</cn><Last Name>Mollo</Last Name><First Name>Kevin</First Name></viewableIdentityAttributes><listAttributes>First Name</listAttributes><listAttributes>Last Name</listAttributes><listAttributes>Email</listAttributes><listAttributes>cn</listAttributes></jsonObject>
In server logs:
[2016-07-14 11:46:35,057] INFO - LogMediator To: http://www.w3.org/2005/08/addr
essing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:3beaaf16-7b94-4e
08-a3e0-7605869572c7, Direction: response, Component = Application1, Payload: {"vi
ewableIdentityAttributes":{"Email":"Kevin.Mollo#companyb.com","cn":"Kevin Mollo"
,"Last Name":"Mollo","First Name":"Kevin"},"assignedRoles":[],"listAttributes":[
"First Name","Last Name","Email","cn"]}
[2016-07-14 11:46:35,057] INFO - LogMediator To: http://www.w3.org/2005/08/addr
essing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:c878c7db-ad4c-49
46-94d6-75aebc75ad8e, Direction: response, Component = Application1, Payload: {"vi
ewableIdentityAttributes":{"Email":"Michelle.Lassauze#companyb.com","cn":"Michel
le Lassauze","Last Name":"Lassauze","First Name":"Michelle"},"assignedRoles":[],
"listAttributes":["First Name","Last Name","Email","cn"]}
As we can see I get responses from both the endpoints in server logs.
As per analysis, I feel to make it work properly and get the responses from both the endpoints, we need change the following:
1. Using call mediator instead of send if we have multiple endpoints to be called.
2. Using enrich mediator to store the responses.
I tried following the above approaches but I am unable to get the expected results as I am not sure how to use enrich mediator in this case.
Please help me in fixing the above issues.
Clone mediator will be used to send identical copies of message to different endpoints.
Iterate mediator will be used to send message chunks of one particular message to different endpoints.
Enrich mediator will be used to change message (Ex: removing content, adding etc.) [1]
Check your endpoints and check whether they provide proper responses to work with aggregate mediator.
I add sample scenario here. You can test that with your ESB pack to understand the above three mediators usage. You just have to start 2 instances of SimpleStockQuote service [2] and publish message to proxy via SOAPUI.
<proxy name="ScatterGatherProxy" startOnLoad="true" trace="disable" transports="https http">
<description/>
<target>
<inSequence>
<clone>
<target>
<sequence>
<send>
<endpoint name="vendorA">
<address uri="http://localhost:9001/services/SimpleStockQuoteService/"/>
</endpoint>
</send>
</sequence>
</target>
<target>
<sequence>
<send>
<endpoint name="vendorB">
<address uri="http://localhost:9002/services/SimpleStockQuoteService/"/>
</endpoint>
</send>
</sequence>
</target>
</clone>
</inSequence>
<outSequence>
<log level="full"/>
<aggregate>
<completeCondition>
<messageCount min="2"/>
</completeCondition>
<onComplete expression="//m0:return"
xmlns:m0="http://services.samples" xmlns:m1="http://services.samples/xsd">
<enrich>
<source clone="true" xpath="//m0:return[not(preceding-sibling::m0:return/m1:last <= m1:last) and not(following-sibling::m0:return/m1:last < m1:last)]"/>
<target type="body"/>
</enrich>
<send/>
</onComplete>
</aggregate>
</outSequence>
</target>
</proxy>
If you need further assistance, please attach more details like responses of your service.
[1] http://dilshanilive.blogspot.com/2016/03/enrich-mediator-wso2-esb.html
[2] https://docs.wso2.com/display/ESB490/Setting+Up+the+ESB+Samples#Starting%20the%20Axis2%20server

WSO2 DOCTYPE not allowed calling REST Api

i m working with this proxy:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="PubMedDataProxy"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<call>
<endpoint>
<http method="get"
uri-template="http://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?dbfrom=omim&Mdb=pubmed&id=230900"/>
</endpoint>
</call>
<log level="custom">
<property name="MyLOg" expression="//eLinkResult/DbFrom/text()"/>
</log>
<respond/>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<description/>
</proxy>
i get this exception:
TID: [0] [ESB] [2015-05-21 13:45:34,838] ERROR {org.apache.synapse.transport.passthru.util.RelayUtils} - Error while building Passthrough stream {org.apache.synapse.transport.passthru.util.RelayUtils}
org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[2,142]
Message: DOCTYPE is not allowed
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:109)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:570)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:566)
at org.apache.axis2.builder.ApplicationXMLBuilder.processDocument(ApplicationXMLBuilder.java:81)
at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:118)
at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:107)
at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:82)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:68)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:239)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:556)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:198)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:488)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:170)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:225)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[2,142]
Message: DOCTYPE is not allowed
...
Calling the service in a normal REST client i get the XML result withouth any problem.
The issue occured when the proxy tries to parse the resulting xml. Indeed removing the Log mediator with the property inside the proxy returns the result correctly.
What am i missing?
Add the following to your proxy:
<parameter name="ApplicationXMLBuilder.allowDTD">true</parameter>
Add the below parameter to the axis2.xml file under the <axisconfig name="AxisJava2.0"> also working.
<parameter name="ApplicationXMLBuilder.allowDTD">true</parameter>

Role based access control to WSO Message Broker Hierarchical Topic

I've recently started experimenting with a Message exchange between WSO2 ESB's via WSO2's MB for a requirement. Created a JMS sender Proxy Service which concatenates endpoint URL based on SOAP Input (used Header property and defaultEndpoint).
On Message Broker:
Have set up a Hierarchical topic as
Root|
Node1
Node2
With 3 users and their specific roles as Root, Node1, Node2. Requirement is Node 1 should be able to subscribe for both Node 1 and Root, Similarly for Node2, Only Node2 and Root.
The problem is When creating a proxy service subscriber can only set it to subscribe one Node only (Root or Node1 or Node2). Tried setting destination as Root.# but then All Nodes are subscribed (even when Node USer is not set to Subscribe the other based on Role based Topic access). Following is the code for subscriber
enter code here
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="Subscriber_Node2"
transports="jms"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property name="OUT_ONLY" value="true"/>
<log level="full"/>
<log level="custom" separator="###">
<property name="STATE"
value="**************** RECEIVED AT Node 2 ***************"/>
</log>
<drop/>
</inSequence>
<outSequence/>
<faultSequence>
<log level="custom">
<property name="text" value="An unexpected error occured"/>
<property name="message" expression="get-property('ERROR_MESSAGE')"/>
<property name="code" expression="get-property('ERROR_CODE')"/>
<property name="detail" expression="get-property('ERROR_DETAIL')"/>
<property name="exception" expression="get-property('ERROR_EXCEPTION')"/>
</log>
</faultSequence>
</target>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
<parameter name="java.naming.factory.initial">
org.wso2.andes.jndi.PropertiesFileInitialContextFactory
</parameter>
<parameter name="transport.jms.ConnectionFactory">
Store2TopicConnectionFactory</parameter>
<parameter name="java.naming.provider.url">
repository/conf/jndi.properties</parameter>
<parameter name="transport.jms.DestinationType">topic</parameter>
<parameter name="transport.jms.Destination">HQ.Store_2</parameter>
<description/>
</proxy>
jndi.properties:
connectionfactory.Node1TopicConnectionFactory = amqp://Node1:Node1#clientID/carbon?
brokerlist='tcp://localhost:5680'
connectionfactory.Node2TopicConnectionFactory = amqp://Node2:Node2#clientID/carbon?
brokerlist='tcp://localhost:5680'
connectionfactory.RootTopicConnectionFactory = amqp://Root1:Root1#clientID/carbon?
brokerlist='tcp://localhost:5680'
topic.Root = Root
topic.Root.Node1 = Root.Node1
topic.Root.Node2 = Root.Node2
Is there a way a Subscriber can subscribe to Multiple Topics in a hierrarchy and its access be controlled by User and Role?

Resources