Skip Headers

# Using Java

Previous

Next

Using Java, you can create any type of EIS interaction that TopLink supports (see "Using EIS Interactions").

For some EIS projects, it is common for multiple interactions to be used in a single query: for example, one interaction to enqueue a request and another to dequeue the response. Because TopLink Workbench does not support setting multiple interactions on a single query, you must use an amendment method to create and configure the interaction in Java as Example Example: Creating an XML Interaction for an AQ Platform shows.

Creating an XML Interaction for an AQ Platform

    public static void addXMLInteractions(ClassDescriptor descriptor) {
        // find order interaction
        XMLInteraction request = new XMLInteraction();
        request.setProperty(AQPlatform.QUEUE_OPERATION, AQPlatform.ENQUEUE);
        request.setProperty(AQPlatform.QUEUE, "ORDER_INBOUND_QUEUE");
        request.setProperty(AQPlatform.SCHEMA, "AQUSER");
        request.setInputRootElementName("READ_ORDER");
        request.addArgument("@id");

        XMLInteraction response = new XMLInteraction();
        response.setProperty(AQPlatform.QUEUE_OPERATION, AQPlatform.DEQUEUE);
        response.setProperty(AQPlatform.QUEUE, "ORDER_OUTBOUND_QUEUE");
        response.setProperty(AQPlatform.SCHEMA, "AQUSER");

        ReadObjectQuery query = new ReadObjectQuery();
        query.addCall(request);
        query.addCall(response);
        descriptor.getQueryManager().setReadObjectQuery(query);

        // place order interaction
        XMLInteraction insert = new XMLInteraction();
        insert.setProperty(AQPlatform.QUEUE_OPERATION, AQPlatform.ENQUEUE);
        insert.setProperty(AQPlatform.QUEUE, "ORDER_INBOUND_QUEUE");
        insert.setProperty(AQPlatform.SCHEMA, "AQUSER");
        insert.setInputRootElementName("INSERT_ORDER");

        descriptor.getQueryManager().setInsertCall(insert);
    }