If your BPEL composite receives input request from more than one source, then you can use Pick activity(adding onmessage branch in pick activity for each source).You can use multiple recieve activites in a BPEL process in case you are calling an async service(s) in your BPEL to receive the outcome of the called web serivce.
hope this helps.
let's say you have a wsdl with multiple operations (addItem, deleteItem, etc)
you create a bpel based on this wsdl.
when you would use a receive you can only select 1 operation, so this means your bpel process can only get triggered by this one operation.
if you want to implement logic in your bpel process which handles both addItem and deleteItem, you would add a pick(createInstance on) as start of your process instead of the receive.
now the client can invoke your service both on the addItem and deleteItem operation, since you selected both operation in the onMessage branches.
your bpel process will receive both calls, and can handle both calls on the different operations
well you could use 2 receives, but when you model your process in jdeveloper with the 2 receives you will notice you can't model it the way you want
this will fail, you can have only 1 reveice with createInstance=YES), so basically this means you could only 'start' your process by calling receive1, and that's not what you want.
a case in which you would use 2 receive and model it like
receive1 (createInstance=YES) (operation = startProcess with payload item=10)
-- start process,
-- now wait for the 'caller' to take some action,caller is done, caller invokes your process again, but now he calls it on 'receive2', basically this means, on the 'running' instance he triggers your process again to continue the processing
, so at this stage the receive2 is some sort of wait, and your process will only continue when the invoke to receive2 is received.
in this case your will need to use correlation
receive2(createInstance=NO) (operation = continueProcess with payload item=10)
in this case we use correlation on the payload element "item"
the bpel framework now knows
1. i start a process on the operation startProcess with correlatino on the value of element "item", in this case "10"
2. steps are executed and i arrive at receive2
3. process will wait overe here
4. the caller does a new call to your process on the operation "continueProcess", we use "item=10" again for the payload on this operation.
5. bpel notice we still have a running instance of our process (since it's waiting on receive2), and uses correlation to see if it matches the instance based on the "item=10".
if yes, then bpel will continue this instance, it will continue with steps after the second receive.
But..in your case you dont want to model like this:
you want something like this :
receive1 (createInstance=YES) - receive2(createInstance=YES) (on 1 level)
and in this case you use a pick-activity.
the pick activity will have (createInstance=YES)
and in in the pick you define your onMessage branches, so something like this.
execute step1 execute step1
execute step2 execute step2
exeute other steps which are defined/needed for both operations
Hope it's a bit clear now