Skip to content

Latest commit

 

History

History
99 lines (81 loc) · 4 KB

File metadata and controls

99 lines (81 loc) · 4 KB

ejb-asynchronous: EJB with asynchronous methods

The ejb-asynchronous quickstart demonstrates the behavior of asynchronous EJB invocations by a deployed EJB and a remote client and how to handle errors.

What is it?

The ejb-asynchronous quickstart demonstrates the behavior of asynchronous EJB invocations in {productNameFull}. The methods are invoked by both an EJB in the deployment and by a remote client. The quickstart also shows error handling if the asynchronous method invocation fails.

This example consists of the following Maven projects, each with a shared parent.

Project Description

ejb

This project contains the EJBs that are deployed to the server.

client

This project contains a remote EJB client.

The root pom.xml builds each of the subprojects in the above order and deploys the archive to the server.

Access the Application

  1. Open a terminal and navigate to the root directory of this quickstart.

  2. Type the following command to start the client.

    $ cd client
    $ mvn exec:exec
  3. Check the client output

    INFO: The server log should contain a message at (about) <date>, indicating that the call to the asynchronous bean completed.
    INFO: Got the async result as expected => returning at <date>, duration was 200ms
    INFO: Got the async result as expected after wait => returning at <date>, duration was 1500ms
    INFO: Catch the expected Exception of the asynchronous execution!
    INFO: Results of the parallel (server) processing : [returning at <date> duration was 5000ms, returning at <date>, duration was 3000ms]
  4. Check the server log. There should be two INFO log messages for the fireAndForget invocation.

    First, you should see the following message.

    'fireAndForget' Will wait for 15000ms

    The second message appears after the client is finished, approximately 15 seconds later.

    action 'fireAndForget' finished

This quickstart consists of multiple projects, so it deploys and runs differently in {JBDSProductName} than the other quickstarts.

  1. Install the required Maven artifacts and deploy the asynchronous EJB quickstart project.

    • Right-click on the {artifactId}-ejb project and choose Run AsMaven Install.

    • Right-click on the {artifactId}-ejb project and choose Run AsRun on Server.

  2. Build and run the client side of the quickstart project.

    • Right-click on the {artifactId}-client project and choose Run AsJava Application.

    • In the Select Java Application window, choose AsynchronousClient - org.jboss.as.quickstarts.ejb.asynchronous.client and click OK.

    • The client output displays in the Console window.

  3. To undeploy the project, right-click on the {artifactId}-ejb project and choose Run AsMaven build. Enter wildfly:undeploy for the Goals and click Run.