Asynchronous simultaneous processing from EJB

Hi all,
Imagine you needed to do some bulky task (say processing of a very big XML doc). The thing takes say 15 min, and you find that unacceptable.
In a normal standalone app, I would split that XML in smaller chunks, and kick off a few threads to process it simultaneously. That would generally do the job a lot quicker (tested).
Now, imagine I wanted to pack that functionality in a Session bean (stateless). The spec bans me from doing threads, as the container should take care of that.
What do I do to achieve the effect of multithreading in EJB?
Note: You can make many instances of your processing Session Bean and feed them chunks, but you can't call them simultaneously, as these calls will be synchronous, and therefore the next chunk of work won't start until the current one has finished.
PS: I guess I could use Message Beans and send them messages, but that sort of seems fishy... Is it?
Thanks a lot,
George

1. Dave's idea worth a try, but I probably would have the helper class take a the xml directly in its constructor instead of calling EJB from each thread. So you can use your standalone java application directly. The only thing is, if we want to stick to the specification, since this helper class is instantiated by an EJB so it is still likely that the container will need to be responsible for it. I guess we can test this through the WebSphere Test Environment on Visual Age for Java. I did not do this kind of test before so this is just a guess. But this leads to the next thought:
2. If your EJB can take the xml and save it in a database and read the result from the database after it is processed, you can have a standalone daemon to process it automatically whenever there is such a xml record saved to the database. Actually, I would do it using io even though it is 'banned' by the specification also. I would have the EJB save the xml into a directory (if it has to be done by an EJB), my daemon will run forever and check this directory every certain time to see if there is any new file saved there. If the answer is yes, it will kick out threads to process it and write the result to (database, calling an EJB method, etc...) and then delete the file.
PC

Similar Messages

  • Invoking asynchronous BPEL process from java ui

    Hi,
    I am invoking an asynchronous BPEL process from java ui.
    I read somewhere that i can obtain an instance handler uing the lookupInstance() method of class Locator using the conversation id provided by the class NormalizedMessage.
    My code looks like this
    // Connect to Oracle BPEL server
    Locator locator = new Locator("default","bpel");
    IDeliveryService deliveryService = (IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME );
    // Construct a normalized message and send to Oracle BPEL Process Manager
    NormalizedMessage nm = new NormalizedMessage();
    nm.addPart("payload", xml);
    // Initiate the BPEL process
    deliveryService.post("MyLoanFlow", "initiate", nm);
    //Obtain the instance handler
    IInstanceHandle handle = locator.lookupInstance(NormalizedMessage.CONVERSATION_ID);
    But this is giving the error - can not find any instance with conversation id 'conversationId'.
    Also, if i try to obtain a list of instance handles associated with a process , it does not contain the most recently created instance
    IBPELProcessHandle ph = locator.lookupProcess("MyLoanFlow");
    IInstanceHandle[] iHandler = ph.listInstances();
    out.println(iHandler.length + "<br>");
    if i invoke the process for the first time the output is 0.
    can you please help me. it is urgent.

    Hi Sudipto,
    Regarding your second question,
    deliveryService.post("MyLoanFlow", "initiate", nm);
    IBPELProcessHandle ph = locator.lookupProcess("MyLoanFlow");
    IInstanceHandle[] iHandler = ph.listInstances();
    out.println(iHandler.length + "<br>");
    ---- returns 0 ---
    This is because MyLoanFlow is an asynchronous process in your case. So the control is returned to your java block immediately after the request for a new instance is posted. And your second line of code(querying for the list of instances) is executed even before the instance is created on the server side. You can verify this in two ways:
    1. try creating an instance of a synchronous process using IDeliveryService.request - this will always result in the increment since the current thread is blocked till the new instance is created.
    2. for your case, you can try
    Thread.currentThread().sleep(500); - just allow the server some time for completing the instance before you query it for the list of instances..
    and wrt question 1,
    //Obtain the instance handler
    IInstanceHandle handle = locator.lookupInstance(NormalizedMessage.CONVERSATION_ID);
    But this is giving the error - can not find any instance with conversation id 'conversationId'.
    For setting the conversationId, you could do so by including the following inside your .bpel file
    <bpelx:exec name="test-setConversationId" language="java" version="1.4">
    <![CDATA[
    setConversationId("conversationId");
    ]]>
    </bpelx:exec>
    The code:
    IInstanceHandle ins = locator.lookupInstanceByConversationId(NormalizedMessage.CONVERSATION_ID);
    should fetch you the required instance in this case.
    HTH,
    Anuj

  • How to call a Asynchronous bpel process from a PLSQL procedure?

    How to call a Asynchronous bpel process from a PLSQL procedure?

    Hi,
    You could do something smart and technical very spiffy with soap-stacks in the database and/or dbms_ws/dbms_http. But I allways find AQ with AQ-adapter the simplest. Let Pl/sql enqueue a message on an aq-queue and subscribe an aq-adapter process on it. That can call your async-bpel process. If you want to get answer back in pl/sql, let the aq-adapter process enqueue a response message on another queue or on the same queue with another consumer name. Give it a correlation-id that you provided in the payload of your request message. Your pl/sql process can then do a dequeue on that correlation-id. It will sit and wait until a message with that correlation id is enqueued on the queue.
    Regards,
    Martien

  • Can we invoke a asynchronous BPEL process from synchronous and vice versa

    Hi,
    Can we invoke a BPEL asynchronous process from synchronous and vice versa. If so how to perform that.
    thanks,
    Vijay

    Yes you can
    sync -- calling --> Asyncc
    Async -- calling --> syncc
    Perfomance is no issue, depending on your requirements. Not the Syncprocesses are short-running processes, these will time-out after 30 seconds, if no answer is coming from the async process.
    Marc
    http://orasoa.blogspot.com

  • Unable to get callback from Asynchronous BPEL process to work (AXIS Client)

    Hello,
    I am calling an Asynchronous BPEL process from an AXIS client, and I am unable to get the callback functionality to work. The AXIS client code has been generated from WSDL2Java using the BPEL process' WSDL file.
    I CAN insert an invoke node in the BPEL process and invoke my Callback web service using that, but obviously that means the BPEL process is limited to only responding to one pre-determined client, which won't work.
    My questions:
    - How does the BPEL process know what endpoint to use to make the callback?
    - Do I need to modify the generated code to create a SOAP Envelope and invoke the process with the envelope, intead of the invokeOneWay call?
    - If I do need to create a SOAP Envelope with a replyto element, what is the structure of a typical BPEL envelope? Is there an example somewhere?
    I have looked at the examples in the interop directory, specifically the AXIS calling Async BPEL, but I would like to try to keep the client code as independent as possible (I don't really want to have a dependency on the OTN library).
    Any help would be greatly appreciated!!
    Thank you.
    -Ryan

    Please have a look at the Binding in the WSDL. Axis must provide the ReplyTo and
    MessageId information there. As far as I see, this must be done by an Axis-Handler,
    because the Binding-Part in not generated by WSDL2Java.
    I was able to generate the JavaClasses by using the "WSDL2Java -a" option, but
    I still do not see how to use them in a handler and how to register the handler.
    Maybe someone can give me a hint.

  • Can an synchronous ESB process initiate an asynchronous BPEL process?

    I have a requirement to create a synchronous ESB service that initiates an aysnchronous BPEL process returning a success message to the requesting system.
    I can create an esb that receives a paylaod from the requesting system and returns a receipt message, I then created an asynchronous bpel process.
    Although I can initiate the asynchronous bpel process from the ESB I cannot work out how to send back the success message? The routing rules do not allow setting of outgoing messages unless you call a synchronous process?

    Can you make the BPEL process synchronous. Calling a asynchronous process breaks your synchronous message, because what happens if your asynchronous process takes longer that 1 minute. The synchronous process will timeout but the asynchronous process will complete.
    The previous note is correct you can use queues but all this will do is tell you that you posted correctly, you get the same result calling a web service. Asynchronous is fire and forget in a ESB world as it is stateless.
    cheers
    James

  • Invoking Asynchronous Web Service from BPEL Process

    Hi,
    I have been working on the BPEL Process Manager for some time and now facing problem in invoking asynchronous web service from a BPEL Process. I have implemented a web service in Java using Axis but wasn't able to invoke it.
    I have gone through all the meterial available on this site but couldn't get any great help.
    Can some one help me in resolving this issue. A pointer to any example or sample material/tutorial will be appreciated.
    thanks
    Farooq

    I do the same thing.
    Take wsdl from axis and save it somewhere.
    Then you can create a standard project in Oracle BPEL PM. Create partnerlink, give a name and click on first icon to take your wsdl. It will add some needed code, you answer always yes. Then you can create receive, assign, invoke, assign and callback or similar and deploy it.
    Try it through BPEL Console...
    Ema

  • How to get response from an asynchronous BPEL process in Java

    I'm experimenting with BPEL and doesn't seem to be able to get response from an asynchronous BPEL process. Here's the deal:
    I have a BPEL process that takes a string as input, and gives another string as output. This is a asyncronous process.
    I want to initiate this BPEL process as a web service so I generate a Webservice Proxy in JDeveloper 10g (10.1.3.0.4). The function to call the process is now called "initiate" and takes three arguments: the input string, a "org.xmlsoap.schemas.ws._2003._03.addressing.EndpointReferenceType replyTo" and a
    "org.xmlsoap.schemas.ws._2003._03.addressing.AttributedURI messageID".
    HTTP-Analyzer shows that invoking the BPEL process with initiate("somestring", null, null) results in sending a SOAP message to the BPEL process, which returns a "202 Accepted". How do I get the response from the process? My intuition tells me that I have to use that second argument, that EnpointReferenceType thing. How do I use that?
    Another question: If a asynchronous BPEL process does not exists (so the endpoint does not exist) the Java proxy does not throw an error when runned. It does not even sends a message. It exits with status 0! (This happens for example when deploying a new version of a process and when the "old" version is undeployed). Calling a non-existing synchronous BPEL process, the Java proxy DOES throw an error.

    Clemens,
    That all sounds logical. But somehow it is still a mystery for me ... Somehow I don't see what should be done.
    To call the async BPEL process I have the following procedure:
    initiate(String input, org.xmlsoap.schemas.ws._2003._03.addressing.EndpointReferenceType replyTo, org.xmlsoap.schemas.ws._2003._03.addressing.AttributedURI messageID)
    The first argument is the input for my BPEL process. The second is the address to a webservice that should handle the callback, right? The third is a messageID (makes sense, but why of the type AttributedURI?).
    Here lies my problem. It is not clear to me how these EndpointReferenceType & AttributedURI work. I can't find anything on the net about it. The AXIS examples as where mentioned earlier use other types (namely the "org.xmlsoap.schemas.ws.addressing.MessageID" and "org.xmlsoap.schemas.ws.addressing.ReplyTo") which are completely different.
    What I did so far:
    - I created an webservice proxy that listens on the onResult endpoint of the BPEL process.
    - I created an webservice proxy that calls the BPEL process through the initiate procedure, but it is not completely clear to me how to construct the EndPointreferenceType replyTo, and the MessageID. I did something like this:
    EndpointReferenceType replyTo = new EndpointReferenceType();
    // callback service running on local machine
    // This URI class is the java.net's version
    URI replyToURI = new URI("http://vaccinatie:8988/syncro-callback-context-root/stringconcatCallbackBindingPort");
    // This AttributedURI is the org.xmlsoap.schemas.ws._2003._03.addressing's version
    AttributedURI address = new AttributedURI();
    // the only public methos that made sense to me:
    address.set_value(replyToURI);
    replyTo.setAddress(address);
    // call the BPEL process
    myPort.initiate("test123", replyTo, address);
    But the above doesn't work (largely because I don't know what I'm doing here prob.:-) ) It does send the "test123" message, and the BPEL process does process it, but I don't seem to get the callback right.
    I hope this makes my problems somewhat clearer. I hope someone can help me, because I'm just a beginner in this whole "web service area" and seems to do something terribly wrong here, because it should be very simple. Thx.

  • How to invoke an other BPM asynchronous process from the BPM process

    Do anyone know how to invoke other asynchronous process from the BPM process without using the Web Service URL?

    Try using a Service task implemented as a Process Call. Then you select the process you want to call, set the associations or transformation and deploy it to test.
    I hope it works for you.
    isabelbernely

  • Asynchronous BPEL Process called from an empty BPEL process getting lost.

    Hi
    I have an empty BPEL process calling an asynchronous BPEL process. The empty process is triggered by a read file activity. It finishes successfully and even calls the asynchronous process. There is no error thrown but the called asynchronous process does not show up in the dashboard.
    When this asynchronous process is manually run from the console I get the page stating 'Cannot find the specified instance'.
    I am using Jdev 10.1.3.2 and SOA Suit 10.1.3.1.
    Any suggestion as to why this is happening and what is the remedy?
    Buddhadev.

    Check your log as soon as you find that the parent process has found its way into the console. More information on logging can be found here - http://download-uk.oracle.com/docs/cd/B31017_01/integrate.1013/b28982/logging.htm
    Not quite sure why its so, but since 10.1.3, I've observed that the console simply doesn't show errored processes at times. So, checking the log can be a starting point in diagnosing the real issue.
    HTH
    Antony

  • Throwing a fault from an asynchronous bpel process

    Hi,
    can anyone please let me know how i can throw a fault to the calling client from an asynchronous bpel process?
    (synchronous bpel uses the fault of the reply activity to do the same - i want a similar thing in a callback-invoke of an asynchronous process or any other way to do it if at all)
    please let me know if it is possible becoz it was a requirement put forward by a customer and i just want to develop a proof of concept to the same.
    regards,
    pavan.

    Hi,
    I'm using BPEL process manager for calling a asynchronous web service,I can invoke the service from BPEL and the service is invoked correctly,but when I view the business process flow in BPEL Console my process is stopped at receive state and doesn't pass it.
    Could anybody tell me if any thing should be set to receive a callback from an asynchronous web service to BPEL process?
    Is it true that BPEL process receives a callback automatically (using a callback operation which I defined in my web service WSDL) on the same port type that normally receives the requested information, with an invoke activity?
    So what could be wrong with my process or invoked web service that the BPEL process doesn't get any reply from my web service and remains in receive activity?
    Thnx in advance,
    Nasim

  • HowTo get the callback from an asynchronous BPEL process to an ESB?

    Hi,
    I have deployed an asynchronous BPEL-process which is called from an ESB. So far no problems. But I want to receive the callboack fromt this BPEL process on the ESB, too.
    How is this possible?
    Note: I have created the BPEL-Process before I created the ESB. So I cannot add the ESB as a partner link in the BPEL Process. Or is this the only way?
    Message was edited by:
    user636134

    Hi,
    I have deployed an asynchronous BPEL-process which is called from an ESB. So far no problems. But I want to receive the callboack fromt this BPEL process on the ESB, too.
    How is this possible?
    Note: I have created the BPEL-Process before I created the ESB. So I cannot add the ESB as a partner link in the BPEL Process. Or is this the only way?
    Message was edited by:
    user636134

  • Restrict number of simultaneous connection from client to EJB bean

    I have EJB bean and JavaSE client. I want to restrict number of simultaneous connection from client to EJB bean. For example to maximum allowed 3. How I can do it?

    :) but answer is too general.
    I want to know how to design such "simple reference counting". As I understand it is not recommended to use static variables in EJB. so how to implement such counting in a right way?
    Edited by: NoName on Aug 20, 2009 1:25 AM
    Edited by: NoName on Aug 20, 2009 1:31 AM

  • Retrieving Status/Results from Asynchronous BPEL Processes

    Hi,
    I'm trying to poll the results of an asynchronous BPEL process with Java RMI. I managed to get the state of my instance, but i could not get the results of the process.
    When I use the method getResult I only get an empty Object[]. (see my attached code)
    I'm working with the tutorial 101.HelloWorld process.
    How can I acess the results of this process by using RMI?
    Thank youf for replies.
    Marc
    Properties props = new java.util.Properties();
    java.net.URL url = ClassLoader.getSystemResource("context.properties");
    props.load(url.openStream());
    Locator locator = new Locator("default", "bpel", props);
    IInstanceHandle handle = locator.lookupInstance("myInstance");
    if (handle.getState() == IInstanceConstants.STATE_CLOSED_COMPLETED)
    System.err.println(handle.getResult());
    }

    Hi,
    I am having exactly the same problem.
    Was this bug ever solved ?
    Thanks,
    Claudio.

  • Error while invoking an asynchronous BPEL process

    Hi ,
    I am trying to call an asynchronous BPEL process through java client.
    Following is the code which I got from SOA bpel samples present in the following location
    <SOA_HOME>\bpel\samples\tutorials\102.InvokingProcesses\rmi\com\otn\samples\async
    The code fails while registering the callback
    String convId = GUIDGenerator.generateGUID();
    nm.setProperty(NormalizedMessage.CONVERSATION_ID, convId);
    deliveryService.post("HelloWorld", "initiate", nm);
    // register the callback
    watchdog.registerAsyncCallback(convId, testAsyncHandler,
    locator.getDomainAuth());
    The error says java.lang.NoClassDefFoundError: org/collaxa/thirdparty/json/JSONString
    I tried to search for this in google. But it seems noone has got this error or maybe noone has used this at all.
    Maybe I am missing some jar file, but I am unable locate that.
    Can someone help me in this please.

    Hi,
    These sort of class not found errors come when you are running from a client which does not have all the jar files requried to invoke BPEL using the client API.
    org/collaxa/thirdparty/json/JSONString is orabpel-thirdparty.jar.
    The complete list of Jar files you would need in the classpath are:
    ejb.jar ($ORACLE_HOME/home/lib)
    oc4j-internal.jar ($ORACLE_HOME/home/lib)
    optic.jar ($ORACLE_HOME/opmn/lib)
    orabpel-common.jar ($ORACLE_HOME/bpel/lib)
    orabpel-thirdparty.jar ($ORACLE_HOME/bpel/lib)
    orabpel.jar ($ORACLE_HOME/bpel/lib)
    Hope this helps,
    Regards,
    Shanmu.
    http://www.prshanmu.com/articles/

Maybe you are looking for

  • How to use POwn, PCon or PMin in Consolidation

    Dear all experts , Do you know how to differentiate consolidation from one account with another? The condition is : Assets : PCon Liabilities : PCon Account (NCI, Capital Reserve, etc) : POwn Is this possible? Actually when and how to use PCon, POwn

  • VPN on my Lumia 920.

    Nokia Lumia 920 bought from turkey.I'm in Iran.Do not use Facebook and YouTube in Iran.How do VPN contact me? Moderator's Note: We have changed the title into a subject-related title. This is to keep the forum organized and let other forum users easi

  • HERE maps latest update

    Of late HERE maps have lauched a newer version of this app for Nokia X series phones but I can't update HERE maps OTA on my Nokia X running software version 1.2.4.1. What to do? Help me and tell me how many of you are having the same problem and what

  • Is it a bug about element's depth?

    I have two elements in one frame and if I use: alert(fl.getDocumentDOM().getTimeline().layers[1].frames[2].elements[0].depth); alert(fl.getDocumentDOM().getTimeline().layers[1].frames[2].elements[1].depth); It shows me 0 and 1, It is all right! But i

  • Got confirmation of my iTunes gift cards shipping (for iPhone refund)

    Just got the e-mail: Hello Christopher, We wanted to let you know that your order has shipped. If you ordered multiple items, you may receive separate shipments with no additional shipping charges. All shipments except those delivered by the U.S. Pos