if there any possibility for returning the result to the client in the middle of a synchronous BPEL process?
I put the reply component in the middle of BPEL process, but the client still will wait for the whole process completed. I am wondering how the reply mechanism works in BPEL for synchronous.
Yes, you can place Reply activity and do some other activities after it.
But you have to place Wait activity after Reply to force BPEL engine to actually send the reply message.
Also the Wait activity has to be configured to wait for 3 seconds minimum or the value of MinBPELWait property in the System MBean Browser of Oracle Enterprise Manager Fusion Middleware Control. Otherwise the server will ignore it.
see: http://docs.oracle.com/cd/E23943_01/dev.1111/e10224/bp_events.htm#SOASE516
You can have the reply activity anywhere you want to send the response back to the client. Whatever the activities after the reply activity get executed as expected.
One thing you need to make sure is that, only one reply activity can be there for the respective receive activity.
Instead of wait, you can use a dehydrate activity. The concept is that unless the transaction completes, bpel doesn't reply, so you basically need to end the transaction where you use a reply activity. To do that you have to commit the transaction, so that new transaction can begin.
Note: using a wait would slow your bpel process.
in your composite.xml try modifying below properties of your synchronous bpel component, it should be working with out adding dehydration or wait and there should be no wait at client call.
bpel.config.transaction = required
bpel.config.oneWayDeliveryPolicy=async.persist
Your best bet would be to add a dehydrate activity after your reply, this will force BPEL to complete the transaction then start a new one.
Related
I have a simple integration flow that poll data based on a cron job from database, publish on a DirectChannel, then do split and transformations, and publish on another executor service channel, do some operations and finally publish to an output channel, its written using dsl style.
Also, I have an endpoint where I might receive an http request to trigger this flow, at this point I send the messages one of the mentioned channels to trigger the flow.
I want to make sure that the manual trigger doesn’t happen if the flow is already running due to either the cron job or another request.
I have used the isRunning method of the StandardIntegrationFlow, but it seems that it’s not thread safe.
I also tried using .wireTap(myService) and .handle(myService) where this service has an atomicBoolean flag but it got set per every message, which is not a solution.
I want to know if the flow is running without much intervention from my side, and if this is not supported how can I apply the atomic boolean logic on the overall flow and not on every message.
How can I simulate the racing condition in a test in order to make sure my implementation prevent this?
The IntegrationFlow is just a logical container for configuration phase. It does have those lifecycle methods, but only for an internal framework logic. Even if they are there, they don't help because endpoints are always running if you want to do them something by some event or input message.
It is hard to control all of that since it is in an async state as you explain. Even if we can stop a SourcePollingChannelAdapter in the beginning of that flow to let your manual call do do something, it doesn't mean that messages in other threads are not in process any more. The AtomicBoolean cannot help here for the same reason: even if you set it to true in the MessageSourceMutator.beforeReceive() and reset back to false in its afterReceive() when message is null, it still doesn't mean that messages you pushed down in other thread are already processed.
You might consider to use an aggregator for AtomicBoolean resetting in the end of batch since you mention that you pull data from DB, so perhaps there is a number of records per poll you can track downstream. This way your manual call could be skipped until aggregator collects results for that batch.
You also need to think about stopping a SourcePollingChannelAdapter at the moment when manual action is permitted, so there won't be any further race conditions with the cron.
I would implement a timeout event in quarkus and I search the best way to do that.
Problem summary :
I have a process who wait answer from a REST service
If the service is call, I'll go to next process
If the service isn't call before the delay => I must not validate the process and go to the next process
So I'm thinking of using the quarkus event bus, with a delayed message. If the message is send, I close the process and go to the next process. If the client answer before the delay, the message will never be send (how can do that?)
Thanks you
We have a requirement in where we need to send only one message at a time to a backend process. The call back of this process takes around an hour, only after the call back can we send another request to the process.
I am trying to achieve this by using a manager bpel process that will hold the messages first if there is already something being processed in the backend, and then send it once it realizes that the backend is free. This approach will work, but our architect wants a cleaner solution. He suggested using JMS queues. The idea is for the jms queue to messages to be read by a amanger one at a time, only moving on to the next one once we receive the callback from the backend and we know that the composite and bpel instance is finished. I've been scouring the internet for weeks, but I couldn't find a working jms based solution for my requirement.
I've tried the suggestions for this link but turning on unit of order and acknowledgement properties does nothing.
Try this approach!!
Use a event driven bpel process.
Use a database flag as your next trigger. (flag is TRUE)
jms Adapter receives first message from the queue. Here use a delay in the adapter since you are expecting the bpel to be long running. use below setting.
<binding.jca config="MyServiceInboundQueue_jms.jca">
<property name="minimumDelayBetweenMessages">10000</property>
<property name="singleton">true</property>
</binding.jca>
if flag == TRUE in the db causes the db adapter to proceed with the bpel process,
else skip the bpel.
mark flag==FALSE
call the backend system
callback is received after an hour.
set flag==TRUE
Hi Jonar,
At my company we always use JMS queues for Asynchronous messaging. You could do with a delay timer build in your composite set to 1 hour and 15 minutes for example, and it will work most of the time, but its hella messy. The whole idea is for any asynchronous process to kick off when a message is put upon its queue target (specified by the JMS queue). The JMS adapter in the composite of your project will pick up the message from the queue when it is free to process the queue. The goal for you would be to put the message on the queue and pick it up from it using the adapter. It will know which message to pick up because you specify which queues it listens to in the adapter.
The following blog post by John-Brown Evans eplains the whole process from step one. It might be a bit tedious, but I found it very helpful. Its using SOa Suite 11g instead of the nowadays more commonly used 12c, but its fundamentals remain the same.
Awesome JMS queue tutorial
I hope this works for you!
Cheers,
Jesper
I have the following structure in my BPEL process.
-> Start process
Invoke web service ->
Do something
Invoke another web service ->
<- Send answer
This synchronous BPEL 2.0 process is implemented in a service I created with Oracle SOA Suite 11g. I want to alter the process to the following:
-> Start process
Invoke web service ->
<- Send answer
Do something
Invoke another web service ->
My problem is that the instance that calls my web service and therefor triggers this BPEL process only needs to know the result of the web service invoked first, the parts "Do something" and the invocation of the other web service can take several seconds and from time to time cause a time out on the consumer side. So the BPEL process has to send the answer after the first invoke but still has do to other stuff. I tried just putting the reply of the output right after the first invocation, but the web service still seems to wait for it to completely finish before continuing in sending the answer to the consumer. Probably because it's defined as a synchronous web service. But I guess I can't define it as an asynchronous service, because the answer of the first invoke is needed. Or do I have to create a second BPEL process which contains just the two last parts and make this one asynchronous? But keep in mind that in the "Do something" part I also need the answer from the first invocation.
Sorry for any errors, I'm not a native English speaker. And thanks for any help!
I just added another BPEL process. Now I have a synchronous and an asynchronous process, both started at the mediator in the composite. Probably not the perfect solution but it does the trick for me.
I am doing some POC's in tibco general palletes and came across onEventTimeout.By reading the docs it says
The On Event Timeout process starter specifies a process to execute when a Wait For ... activity discards an incoming event due to a timeout. A Wait For ... activity’s event timeout is specified by the Event Timeout field on the Event tab of the activity.
So I created one process definition having start,wait and end activity.Then created another process definition and added oneventtimeout starter process from the general activities.Now when I click on event source browse button(binocular icon) then it does not show me the above process definiton(having wait activity).So I guess I may be missing something.
Can any body please tell me how to use it ?
The onEventTimeout process starter will not work with a Wait activity. Try using a "Wait for" type of activity instead, for instance Wait for JMS Queue Message.