|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
faulting on a vfs handling sequenceHi,
I'm using a vfs proxy to process xml files. Vfs has the nice feature that on an error, the files are moved to an error location. Depending on the result of a callout mediator I want to decide whether the vfs should fault or not. How can I make a sequence fault ? I tried the fault and drop mediators, but they don't seem to do the job. I hande the callout response in a <switch> and want to let the <default> clause case an error, so that the vfs knows it has to move the file to the error folder. Any Ideas ? synapse.xml snippets: <syn:callout serviceURL="http://localhost:8080/UM/services/userManagement"> <syn:source xmlns:ns2="http://org.apache.synapse/xsd" xmlns:soapenv="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/foo"/> <syn:target xmlns:ns2="http://org.apache.synapse/xsd" xmlns:soapenv="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/:fooResponse"/> </syn:callout> <syn:switch xmlns:ns2="http://org.apache.synapse/xsd" xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:ns="http://org.apache.synapse/xsd" source="//foo/return/resultCode"> <syn:case regex="0"/> <!-- OK --> <syn:case regex="-502"/> <!-- some other OK --> <syn:default> <syn:log level="custom"> <syn:property name="description" value="ERROR: Invalid response from foo, Faulting"/> <syn:property name="resultCode" expression="//nsi:foo/return/resultCode"/> </syn:log> <!-- here i want the sequence to fault --> <syn:drop/> </syn:default> </syn:switch> Any ideas ? Regards, Harm _______________________________________________ Esb-java-user mailing list Esb-java-user@... https://wso2.org/cgi-bin/mailman/listinfo/esb-java-user |
|
|
Re: faulting on a vfs handling sequenceHarm Verhagen wrote:
> Hi, > > I'm using a vfs proxy to process xml files. > Vfs has the nice feature that on an error, the files are moved to an > error location. > > Depending on the result of a callout mediator I want to decide whether > the vfs should fault or not. How can I make a sequence fault ? > I tried the fault and drop mediators, but they don't seem to do the job. > > I hande the callout response in a <switch> and want to let the > <default> clause case an error, so that the vfs knows it has to move > the file to the error folder. > > Any Ideas ? trigger a fault to the transport. You can try writing a custom mediator and throwing a SynapseException at the mediate method. I am afraid there is no way that you can fault a sequence in the standard configuration, not sure whether that is good or not after looking at your requirement. :-) Thanks, Ruwan > > > synapse.xml snippets: > > > <syn:callout > serviceURL="http://localhost:8080/UM/services/userManagement"> > <syn:source xmlns:ns2="http://org.apache.synapse/xsd" > xmlns:soapenv="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/foo"/> > <syn:target xmlns:ns2="http://org.apache.synapse/xsd" > xmlns:soapenv="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/:fooResponse"/> > </syn:callout> > > > <syn:switch xmlns:ns2="http://org.apache.synapse/xsd" > xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" > xmlns:ns="http://org.apache.synapse/xsd" > source="//foo/return/resultCode"> > <syn:case regex="0"/> > <!-- OK --> > <syn:case regex="-502"/> > <!-- some other OK --> > <syn:default> > <syn:log level="custom"> > <syn:property name="description" value="ERROR: > Invalid response from foo, Faulting"/> > <syn:property name="resultCode" > expression="//nsi:foo/return/resultCode"/> > </syn:log> > <!-- here i want the sequence to fault --> > <syn:drop/> > > </syn:default> > </syn:switch> > > Any ideas ? > > Regards, > Harm > ------------------------------------------------------------------------ > > _______________________________________________ > Esb-java-user mailing list > Esb-java-user@... > https://wso2.org/cgi-bin/mailman/listinfo/esb-java-user > -- Ruwan Linton Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb WSO2 Inc.; http://wso2.org email: ruwan@...; cell: +94 77 341 3097 blog: http://blog.ruwan.org _______________________________________________ Esb-java-user mailing list Esb-java-user@... https://wso2.org/cgi-bin/mailman/listinfo/esb-java-user |
|
|
Re: faulting on a vfs handling sequence> Fault mediator make the message in hand s fault message, it doesn't
> trigger a fault to the transport. You can try writing a custom mediator > and throwing a SynapseException at the mediate method. I am afraid there > is no way that you can fault a sequence in the standard configuration, > not sure whether that is good or not after looking at your requirement. :-) > I tried writing a custom mediator : Unfortunately it doesn't work. Throwing a SynapseException does not trigger the VFS to move the file to the error folder. It still happyly moves my file to the transport.vfs.MoveAfterProcess. mediator snippet: public boolean mediate(MessageContext messageContext) { if (log.isDebugEnabled()) log.debug("FaultMediator.mediate()"); log.error("FaultMediator invoking fault, message = " + message + " , message2 = "); throw new SynapseException("Faulting: " + message + ", " + message2); } I get the folling loggin. [2009-09-02 12:05:16,010] DEBUG - VFSTransportListener Processing file :file:///c:/dir/Incoming/inbox/S_USERDATA_20090713_093939_000008.xml [2009-09-02 12:05:16,026] INFO - LogMediator To: ,MessageID: urn:uuid:F9C82012783CAD548C1251885917857,Directi on: request [2009-09-02 12:05:16,041] ERROR - FaultMediator FaultMediator invoking fault, message = txt , message2 = [2009-09-02 12:05:16,041] DEBUG - VFSTransportListener Processed file : file:///c:/dir/Incoming/inbox/S_USERDATA_20090713_093939_000008.xml of Content-type : application/xml [2009-09-02 12:05:16,041] DEBUG - VFSTransportListener Moving to file :file:///c:/dir/Incoming/processed/S_USERDATA_20090713_093939_000008.xml Besides this problem, an exception not caused by a custom mediator, also doesn't make the VFS move the file to the transport.vfs.MoveAfterFailure|MoveAfterErrors directory. for example: when server in the URL of a call-out sequence is down, you get an exception (as expected). However the VFS still moves the file happily to the transport.vfs.MoveAfterProcess folder. Question: how to trigger the VFS to move a message. (After the VFS itself has successfully read the file) to the MoveAfterErrors|MoveAfterFailure folder. side question: when will MoveAfterFailure be used, and when MoveAfterErrors ? version: ESB v2.1 Regards, Harm _______________________________________________ Esb-java-user mailing list Esb-java-user@... https://wso2.org/cgi-bin/mailman/listinfo/esb-java-user |
|
|
Re: faulting on a vfs handling sequenceHi Harm,
Sorry for the delay in responding. I was busy with some other work. See my comments below; Harm Verhagen wrote: >> Fault mediator make the message in hand s fault message, it doesn't >> trigger a fault to the transport. You can try writing a custom mediator >> and throwing a SynapseException at the mediate method. I am afraid there >> is no way that you can fault a sequence in the standard configuration, >> not sure whether that is good or not after looking at your requirement. :-) >> >> > > I tried writing a custom mediator : > Unfortunately it doesn't work. Throwing a SynapseException does not > trigger the VFS to move the file to the error folder. > It still happyly moves my file to the transport.vfs.MoveAfterProcess. > > mediator snippet: > public boolean mediate(MessageContext messageContext) { > if (log.isDebugEnabled()) > log.debug("FaultMediator.mediate()"); > > log.error("FaultMediator invoking fault, message = " + message + " , > message2 = "); > > throw new SynapseException("Faulting: " + message + ", " + message2); > } > > > I get the folling loggin. > [2009-09-02 12:05:16,010] DEBUG - VFSTransportListener Processing file > :file:///c:/dir/Incoming/inbox/S_USERDATA_20090713_093939_000008.xml > [2009-09-02 12:05:16,026] INFO - LogMediator To: ,MessageID: > urn:uuid:F9C82012783CAD548C1251885917857,Directi > on: request > [2009-09-02 12:05:16,041] ERROR - FaultMediator FaultMediator invoking > fault, message = txt , message2 = > [2009-09-02 12:05:16,041] DEBUG - VFSTransportListener Processed file > : file:///c:/dir/Incoming/inbox/S_USERDATA_20090713_093939_000008.xml > of Content-type : application/xml > [2009-09-02 12:05:16,041] DEBUG - VFSTransportListener Moving to file > :file:///c:/dir/Incoming/processed/S_USERDATA_20090713_093939_000008.xml > > > Besides this problem, an exception not caused by a custom mediator, > also doesn't make the VFS move the file to the > transport.vfs.MoveAfterFailure|MoveAfterErrors directory. > for example: when server in the URL of a call-out sequence is down, > you get an exception (as expected). However the VFS still moves the > file happily to the transport.vfs.MoveAfterProcess folder. > any of those :-(, the fact that the transports are asynchronous makes it bit hard to trigger the errors from the mediation to the transport listener error flow. That is because the transport listener is operating with a separate thread pool and gives the control to the worker pool once it is read, and worker pool handles the mediation. Because of that the above configurations applies only for the transport level failures (basically I/O errors when reading the file or any issues related to loading the file into the environment) > Question: how to trigger the VFS to move a message. (After the VFS > itself has successfully read the file) to the > MoveAfterErrors|MoveAfterFailure folder. > There is no way at least for the moment, without some configuration to do it at the configuration it self. For example you may setup an onError sequence to send the file to location specified in the MoveAfterErrors location by using a VFS endpoint. > side question: when will MoveAfterFailure be used, and when MoveAfterErrors ? > Well, MoveAfterErrors seem to be obsolete and not in use MoveAfterFailure occurs when there is an file read/load errors. Thanks, Ruwan > > version: ESB v2.1 > > Regards, > Harm > > _______________________________________________ > Esb-java-user mailing list > Esb-java-user@... > https://wso2.org/cgi-bin/mailman/listinfo/esb-java-user > > -- Ruwan Linton Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb WSO2 Inc.; http://wso2.org email: ruwan@...; cell: +94 77 341 3097 blog: http://blog.ruwan.org _______________________________________________ Esb-java-user mailing list Esb-java-user@... https://wso2.org/cgi-bin/mailman/listinfo/esb-java-user |
|
|
Re: faulting on a vfs handling sequenceRuwan wrote
> I went through the code and realized that the mediation cannot trigger > any of those :-(, the fact that the transports are asynchronous makes it > bit hard to trigger the errors from the mediation to the transport > listener error flow. That is because the transport listener is operating > with a separate thread pool and gives the control to the worker pool > once it is read, and worker pool handles the mediation. Thats unfortunate. I guess thats what typically would be expected from a file reader component. > Because of that the above configurations applies only for the transport > level failures (basically I/O errors when reading the file or any issues > related to loading the file into the environment) > > Question: how to trigger the VFS to move a message. (After the VFS > > itself has successfully read the file) to the > > MoveAfterErrors|MoveAfterFailure folder. > > > There is no way at least for the moment, without some configuration to > do it at the configuration it self. For example you may setup an onError > sequence to send the file to location specified in the MoveAfterErrors > location by using a VFS endpoint. sequence? (then a custom mediator could do the file moving). Regards, Harm _______________________________________________ Esb-java-user mailing list Esb-java-user@... https://wso2.org/cgi-bin/mailman/listinfo/esb-java-user |
|
|
Re: faulting on a vfs handling sequenceHarm Verhagen wrote:
> Ruwan wrote > >> I went through the code and realized that the mediation cannot trigger >> any of those :-(, the fact that the transports are asynchronous makes it >> bit hard to trigger the errors from the mediation to the transport >> listener error flow. That is because the transport listener is operating >> with a separate thread pool and gives the control to the worker pool >> once it is read, and worker pool handles the mediation. >> > Thats unfortunate. I guess thats what typically would be expected from > a file reader component. > > >> Because of that the above configurations applies only for the transport >> level failures (basically I/O errors when reading the file or any issues >> related to loading the file into the environment) >> >>> Question: how to trigger the VFS to move a message. (After the VFS >>> itself has successfully read the file) to the >>> MoveAfterErrors|MoveAfterFailure folder. >>> >>> >> There is no way at least for the moment, without some configuration to >> do it at the configuration it self. For example you may setup an onError >> sequence to send the file to location specified in the MoveAfterErrors >> location by using a VFS endpoint. >> > Is there a way to access the actual filename beeing processed in a > sequence? (then a custom mediator could do the file moving). > mediator on the onError sequence, you could access the file name which is being processing by using the following code fragment within a mediator; String fileName = ((Map) msgCtx.getProperty(MessageContext.TRANSPORT_HEADERS)).get(VFSConstants.FILE_NAME).toString(); Hope this will help you. Thanks, Ruwan > Regards, > Harm > > _______________________________________________ > Esb-java-user mailing list > Esb-java-user@... > https://wso2.org/cgi-bin/mailman/listinfo/esb-java-user > > -- Ruwan Linton Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb WSO2 Inc.; http://wso2.org email: ruwan@...; cell: +94 77 341 3097 blog: http://blog.ruwan.org _______________________________________________ Esb-java-user mailing list Esb-java-user@... https://wso2.org/cgi-bin/mailman/listinfo/esb-java-user |
| Free embeddable forum powered by Nabble | Forum Help |