GVCoreEJBClient

From GreenVulcano Wiki
Revision as of 13:48, 3 August 2012 by G.dimaio (talk | contribs) (Created page with "Class FQN: '''it.greenvulcano.gvesb.core.ejb.client.GVCoreEJBClient''' ==Following the GVCoreEJBClient public static methods== <syntaxhighlight lang="java5"> /** * Inv...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Class FQN: it.greenvulcano.gvesb.core.ejb.client.GVCoreEJBClient

Following the GVCoreEJBClient public static methods

    /**
     * Invoke a RequestReply operation on the input.service Service.
     * 
     * @param input
     *        the input GVBuffer
     * @return the service output GVBuffer
     * @throws GVException on error
     */
    public static GVBuffer requestReply(GVBuffer input) throws GVException

    /**
     * Invoke an asynchronous Request operation on the input.service Service.
     * 
     * @param input
     *        the input GVBuffer
     * @throws GVException on error
     */
    public static void request(GVBuffer input) throws GVException

    /**
     * Invoke an asynchronous GetReply operation on the input.service Service.
     * 
     * @param input
     *        the input GVBuffer
     * @return the service output GVBuffer
     * @throws GVException on error
     */
    public static GVBuffer getReply(GVBuffer input) throws GVException

    /**
     * Invoke a specific operation on the input.service Service.
     * 
     * @param operation
     *        the operation to invoke, can be an Operation name or Forward name
     * @param input
     *        the input GVBuffer
     * @return the service output GVBuffer
     * @throws GVException on error
     */
    public static GVBuffer call(String operation, GVBuffer input) throws GVException


Follows some usage examples:

/* 
 * Invoke a synchronous service
 */
GVBuffer in = new GVBuffer("GVESB", "TOUPPER#GVESB");
in.setObject("test test test");

GVBuffer out = GVCoreEJBClient.requestReply(in);
System.out.println("\nGVBuffer out:\n" + out);


/* 
 * Invoke an asynchronous service
 */
GVBuffer in = new GVBuffer("GVESB", "TOUPPER_A");
in.setObject("test test test");

// invoke the request
GVCoreEJBClient.request(in);
// reset the payload, but keep the same ID of the request
in.setObject(null);
// invoke the getreply
GVBuffer out = GVCoreEJBClient.getReply(in);
System.out.println("\nGVBuffer out:\n" + out);