forked from jboss-developer/jboss-eap-quickstarts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.html
110 lines (110 loc) · 7.76 KB
/
README.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!DOCTYPE html>
<html>
<head><title> ejb-asynchronous: EJB with asynchronous methods</title>
<link href="http://static.jboss.org/ffe/0/www/vendor/redhat/documentation.css" rel="stylesheet"></link>
<link href="http://static.jboss.org/ffe/0/www/vendor/redhat/pygments.css" rel="stylesheet"></link>
</head>
<body><h1><a href="#ejb-asynchronous-ejb-with-asynchronous-methods" id="ejb-asynchronous-ejb-with-asynchronous-methods">ejb-asynchronous: EJB with asynchronous methods</a></h1>
<p>Author: Wolf-Dieter Fink<br />
Level: Advanced<br />
Technologies: Asynchronous EJB<br />
Summary: The <code>ejb-asynchronous</code> quickstart demonstrates the behavior of asynchronous EJB invocations by a deployed EJB and a remote client and how to handle errors.<br />
Target Product: JBoss EAP<br />
Source: <a href="https://github.com/jboss-developer/jboss-eap-quickstarts/">https://github.com/jboss-developer/jboss-eap-quickstarts/</a></p>
<h2><a href="#what-is-it" id="what-is-it">What is it?</a></h2>
<p>The <code>ejb-asynchronous</code> quickstart demonstrates the behavior of asynchronous EJB invocations in Red Hat JBoss Enterprise Application Platform. 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.</p>
<p>The example is composed of 2 Maven modules, each with a shared parent. The modules are as follows:</p>
<ul>
<li><code>ejb</code>: This module contains the EJB's and will be deployed to the server</li>
<li><code>client</code> : This module contains a remote EJB client</li>
</ul>
<p>The root <code>pom.xml</code> builds each of the submodules in the above order and deploys the archive to the server.</p>
<h2><a href="#system-requirements" id="system-requirements">System Requirements</a></h2>
<p>The application this project produces is designed to be run on Red Hat JBoss Enterprise Application Platform 7.1 or later.</p>
<p>All you need to build this project is Java 8.0 (Java SDK 1.8) or later and Maven 3.3.1 or later. See <a href="https://github.com/jboss-developer/jboss-developer-shared-resources/blob/master/guides/CONFIGURE_MAVEN_JBOSS_EAP7.md#configure-maven-to-build-and-deploy-the-quickstarts">Configure Maven for JBoss EAP 7.1</a> to make sure you are configured correctly for testing the quickstarts.</p>
<h2><a href="#use-of-eap7-home" id="use-of-eap7-home">Use of EAP7_HOME</a></h2>
<p>In the following instructions, replace <code>EAP7_HOME</code> with the actual path to your JBoss EAP installation. The installation path is described in detail here: <a href="https://github.com/jboss-developer/jboss-developer-shared-resources/blob/master/guides/USE_OF_EAP7_HOME.md#use-of-eap_home-and-jboss_home-variables">Use of EAP7_HOME and JBOSS_HOME Variables</a>.</p>
<h2><a href="#start-the-server" id="start-the-server">Start the Server</a></h2>
<ol>
<li>Open a command prompt and navigate to the root of the JBoss EAP directory.</li>
<li>The following shows the command line to start the server:
<pre><code>For Linux: EAP7_HOME/bin/standalone.sh
For Windows: EAP7_HOME\bin\standalone.bat
</code></pre>
</li>
</ol>
<h2><a href="#build-and-deploy-the-quickstart" id="build-and-deploy-the-quickstart">Build and Deploy the Quickstart</a></h2>
<ol>
<li>Make sure you have started the JBoss EAP server as described above.</li>
<li>Open a command prompt and navigate to the root directory of this quickstart.</li>
<li>Type this command to build and deploy the archive:
<pre><code>mvn clean install wildfly:deploy
</code></pre>
</li>
<li>This will deploy <code>ejb/target/ejb-asynchronous-ejb.jar</code> to the running instance of the server.</li>
</ol>
<p>Check whether the application is deployed successfully.</p>
<h2><a href="#access-the-application" id="access-the-application">Access the Application</a></h2>
<ol>
<li>Open a command prompt and navigate to the root directory of this quickstart.</li>
<li>Type this command to start the client
<pre><code>cd client
mvn exec:exec
</code></pre>
<p><strong>Note</strong>: This quickstart requires <code>quickstart-parent</code> artifact to be installed in your local Maven repository. To install it, navigate to quickstarts project root directory and run the following command:</p>
<pre><code>mvn clean install
</code></pre>
</li>
<li>
<p>Check the client output</p>
<pre><code>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]
</code></pre>
</li>
<li>
<p>Check the server log.</p>
<p>There should be two INFO log messages for the <code>fireAndForget</code> invocation:</p>
<pre><code>'fireAndForget' Will wait for 15000ms
</code></pre>
<p>and 15sec later (the client should be finished at this time)</p>
<pre><code>action 'fireAndForget' finished
</code></pre>
</li>
</ol>
<h2><a href="#undeploy-the-archive" id="undeploy-the-archive">Undeploy the Archive</a></h2>
<ol>
<li>Make sure you have started the JBoss EAP server as described above.</li>
<li>Open a command prompt and navigate to the root directory of this quickstart.</li>
<li>When you are finished testing, type this command to undeploy the archive:
<pre><code>mvn wildfly:undeploy
</code></pre>
</li>
</ol>
<h2><a href="#run-the-quickstart-in-red-hat-jboss-developer-studio-or-eclipse" id="run-the-quickstart-in-red-hat-jboss-developer-studio-or-eclipse">Run the Quickstart in Red Hat JBoss Developer Studio or Eclipse</a></h2>
<p>You can also start the server and deploy the quickstarts or run the Arquillian tests from Eclipse using JBoss tools. For general information about how to import a quickstart, add a JBoss EAP server, and build and deploy a quickstart, see <a href="https://github.com/jboss-developer/jboss-developer-shared-resources/blob/master/guides/USE_JBDS.md#use-jboss-developer-studio-or-eclipse-to-run-the-quickstarts">Use JBoss Developer Studio or Eclipse to Run the Quickstarts</a>.</p>
<p>This quickstart consists of multiple projects, so it deploys and runs differently in JBoss Developer Studio than the other quickstarts.</p>
<ol>
<li>Install the required Maven artifacts and deploy the asynchronous EJB quickstart project.
<ul>
<li>Right-click on the <code>ejb-asynchronous-ejb</code> project and choose <code>Run As</code> --> <code>Maven Install</code>.</li>
<li>Right-click on the <code>ejb-asynchronous-ejb</code> project and choose <code>Run As</code> --> <code>Run on Server</code>.</li>
</ul>
</li>
<li>Build and run the client side of the quickstart project.
<ul>
<li>Right-click on the <code>ejb-asynchronous-client</code> project and choose <code>Run As</code> --> <code>Java Application</code>.</li>
<li>In the <code>Select Java Application</code> window, choose <code>AsynchronousClient - org.jboss.as.quickstarts.ejb.asynchronous.client</code> and click <code>OK</code>.</li>
<li>The client output displays in the <code>Console</code> window.</li>
</ul>
</li>
<li>To undeploy the project, right-click on the <code>ejb-asynchronous-ejb</code> project and choose <code>Run As</code> --> <code>Maven build</code>. Enter <code>wildfly:undeploy</code> for the <code>Goals</code> and click <code>Run</code>.</li>
</ol>
<h2><a href="#debug-the-application" id="debug-the-application">Debug the Application</a></h2>
<p>If you want to debug the source code of any library in the project, run the following command to pull the source into your local repository. The IDE should then detect it.</p>
<pre><code>mvn dependency:sources
</code></pre>
</body>
</html>