use of org.jboss.as.quickstarts.ejb.server.RemoteBeanInterface in project quickstart by wildfly.
the class RemoteBeanCaller method remoteOutboundStatefulNoTxBeanCall.
/**
* <p>
* The method calls the remote EJB {@link javax.ejb.Stateful} endpoint.
* </p>
* <p>
* To lookup the remote endpoint is used remote outbound connection defined in the <code>standalone.xml</code> configuration file.
* The deployment links to the configuration by descriptor <code>WEB-INF/jboss-ejb-client.xml</code>.
* </p>
*
* <p>
* This demonstrates what happens on two subsequent calls to the stateful bean when no transaction is started.
* In fact, for stateful bean the demonstrated behaviour makes no difference if the transaction is or is not started.
* </p>
* <p>
* As there are processed two remote EJB invocations and we talk about stateful bean the EJB client has to ensure
* that both calls ends at the same remote server.
* The demonstration does not make much sense when there is started only one instance of the remote server (<code>server2</code>).
* But in case there are two remote servers started (two instances of <code>server2</code> are run)
* then the second EJB invocation has to be directed to the same server as the first one.
* </p>
*
* @return list of strings as return values from the remote beans,
* in this case the return value are hostnames and the jboss node names of the remote application server
* @throws NamingException when remote lookup fails
*/
@TransactionAttribute(value = TransactionAttributeType.NOT_SUPPORTED)
public List<String> remoteOutboundStatefulNoTxBeanCall() throws NamingException {
log.debugf("Calling with outbound connection without transaction to StatefulBean.successOnCall()");
RemoteBeanInterface bean = RemoteLookupHelper.lookupRemoteEJBOutbound("StatefulBean", RemoteBeanInterface.class, true);
return Arrays.asList(bean.successOnCall(), bean.successOnCall());
}
Aggregations