Here is more research done on my route. I am presenting you with different
ways Camel is behaving based on the end() or endChoice() statements
placement. I am adding my questions here.
Can the Camel experts help me to understand how camel works under the
covers? This is getting really frustrating. Any help would be appreciated.
CASE 1 :
.split(body()).stopOnException()
.log("Inside SPlit. Record under Processs :
${body}")
.choice()
.when(transactionRecord)
.choice()
.when(UNDERNOTICE_OR_RESCISSION)
.log("Record of interested type")
.bean(PolicyStatusRequestHelper.class,"getPolicyStatusRequest")
.log("Marshalling to JSON")
.marshal().json()
.log("Sending to JMS Queue")
.inOut(getJmsEndPoint())
.log("JMS Reply - Transaction Status : ${body} ")
//.endChoice() //Actually ends when(UNDERNOTICE_OR_RESCISSION)
.endChoice() //Actually ends
when(transactionRecord)
.end() //Ends split()
.log("Done with record : ${body}")
.end() // May be ends PollEnrich
.log("Completed Processing of File. Sending to Success
Route")
.to(getDirectSuccess());
Result :
Success Status returned : 0
Times Success Route called : Once
Input file moved : No
Lock File Deleted : No
Questions:
Does one endChoice() end 2 choice()/When definitions in case of nested
choice()
CASE 2:
.split(body()).stopOnException()
.log("Inside SPlit. Record under Processs :
${body}")
.choice()
.when(transactionRecord)
.choice()
.when(UNDERNOTICE_OR_RESCISSION)
.log("Record of interested type")
.bean(PolicyStatusRequestHelper.class,"getPolicyStatusRequest")
.log("Marshalling to JSON")
.marshal().json()
.log("Sending to JMS Queue")
.inOut(getJmsEndPoint())
.log("JMS Reply - Transaction Status : ${body} ")
//.endChoice() //Actually ends when(UNDERNOTICE_OR_RESCISSION)
.endChoice() //Actually ends
when(transactionRecord)
.end() //Ends split()
.log("Done with record : ${body}")
//.end() // May be ends PollEnrich
.log("Completed Processing of File. Sending to Success
Route")
.to(getDirectSuccess());
Result :
Success Status returned : FILE ARRAY LIST
Times Success Route called : More than Once
Input file moved : No
Lock File Deleted : YES
Questions:
What does the second end() close in this case?
The whole route runs to the end after SPLIT() in this case. Where does scope
of split actually end?
CASE 3 :
.split(body()).stopOnException()
.log("Inside SPlit. Record under Processs :
${body}")
.choice()
.when(transactionRecord)
.choice()
.when(UNDERNOTICE_OR_RESCISSION)
.log("Record of interested type")
.bean(PolicyStatusRequestHelper.class,"getPolicyStatusRequest")
.log("Marshalling to JSON")
.marshal().json()
.log("Sending to JMS Queue")
.inOut(getJmsEndPoint())
.log("JMS Reply - Transaction Status : ${body} ")
//.endChoice() //Actually ends when(UNDERNOTICE_OR_RESCISSION)
.endChoice() //Actually ends
when(transactionRecord)
.end() //Ends split()
.log("Done with record : ${body}")
.end() // May be ends PollEnrich
.log("Completed Processing of File. Sending to Success
Route")
.to(getDirectSuccess());
Result :
Success Status returned : 0
Times Success Route called : Once
Input file moved : No
Lock File Deleted : NO
Questions:
Split works as expected in this case.
Array List is sent to success route. But success route returns a 0.
CASE 4:
.split(body()).stopOnException()
.log("Inside SPlit. Record under Processs :
${body}")
.choice()
.when(transactionRecord)
.choice()
.when(UNDERNOTICE_OR_RESCISSION)
.log("Record of interested type")
.bean(PolicyStatusRequestHelper.class,"getPolicyStatusRequest")
.log("Marshalling to JSON")
.marshal().json()
.log("Sending to JMS Queue")
.inOut(getJmsEndPoint())
.log("JMS Reply - Transaction Status : ${body} ")
//.endChoice() //Actually ends when(UNDERNOTICE_OR_RESCISSION)
//.endChoice() //Actually ends
when(transactionRecord)
.end() //Ends split()
.log("Done with record : ${body}")
.end() // May be ends PollEnrich
.log("Completed Processing of File. Sending to Success
Route")
.to(getDirectSuccess());
Result :
Success Status returned : File ARRAY LIST
Times Success Route called : More than Once
Input file moved : No
Lock File Deleted : YES
Questions:
After Split the route runs to the end. What does the two end() statements
actually end in this case?
JMS reply is sent is sent to success route. No sure where the Success route
reply is going to.
Main class is recieving the whole file array list in the response. Not sure
where this is getting returned from.
Why is the lock file or the input file not moved to the processed directory
when done processing? What is camel actually waiting on ?
Here is my file endpoint :
"file://"+getFolderLocation()+"?moveFailed=.ErroredFiles&move=.ProcessedFiles&doneFileName=${file:name.noext}.don";
Thanks !
Sri Harsha Y.
--
View this message in context:
http://camel.465427.n5.nabble.com/Issue-with-using-onException-tp5732200p5732229.html
Sent from the Camel - Users mailing list archive at Nabble.com.