Package org.jboss.errai.bus.server

Examples of org.jboss.errai.bus.server.MessageDeliveryFailure


    @SuppressWarnings({"unchecked"})
    public void callback(Message message) {
        Object[] parms = message.get(Object[].class, "MethodParms");

        if ((parms == null && targetTypes.length != 0) || (parms.length != targetTypes.length)) {
            throw new MessageDeliveryFailure("wrong number of arguments sent to endpoint. (received: "
                    + (parms == null ? 0 : parms.length) + "; required: " + targetTypes.length + ")");
        }
        for (int i = 0; i < parms.length; i++) {
            if (parms[i] != null && !targetTypes[i].isAssignableFrom(parms[i].getClass())) {
                if (canConvert(targetTypes[i], parms[i].getClass())) {
                    parms[i] = convert(parms[i], targetTypes[i]);
                } else {
                    throw new MessageDeliveryFailure("type mismatch in method parameters");
                }
            }
        }

        try {
            createConversation(message)
                    .subjectProvided().signalling()
                    .with("MethodReply", method.invoke(genericSvc, parms))
                    .noErrorHandling().sendNowWith(bus);
      
        }
        catch (Exception e) {
            throw new MessageDeliveryFailure("error invoking endpoint", e);
        }
    }
View Full Code Here


     */
    public void callback(Message message) {
        Object[] parms = message.get(Object[].class, "MethodParms");

        if ((parms == null && targetTypes.length != 0) || (parms.length != targetTypes.length)) {
            throw new MessageDeliveryFailure("wrong number of arguments sent to endpoint. (received: "
                    + (parms == null ? 0 : parms.length) + "; required: " + targetTypes.length + ")");
        }
        for (int i = 0; i < parms.length; i++) {
            if (parms[i] != null && !targetTypes[i].isAssignableFrom(parms[i].getClass())) {
                if (canConvert(targetTypes[i], parms[i].getClass())) {
                    parms[i] = convert(parms[i], targetTypes[i]);
                } else {
                    throw new MessageDeliveryFailure("type mismatch in method parameters");
                }
            }
        }

        try {
            createConversation(message)
                    .subjectProvided().signalling()
                    .with("MethodReply", method.invoke(genericSvc, parms))
                    .noErrorHandling().sendNowWith(bus);
      
        }
        catch (Exception e) {
            throw new MessageDeliveryFailure("error invoking endpoint", e);
        }
    }
View Full Code Here

     *
     * @param message - the message in question
     */
    public void callback(Message message) {
        if (!endpoints.containsKey(message.getCommandType())) {
            throw new MessageDeliveryFailure("no such endpoint '" + message.getCommandType() + "' in service: " + message.getSubject());
        }
        endpoints.get(message.getCommandType()).callback(message);
    }
View Full Code Here

     */
    public void callback(Message message) {
        Object[] parms = message.get(Object[].class, "MethodParms");

        if ((parms == null && targetTypes.length != 0) || (parms.length != targetTypes.length)) {
            throw new MessageDeliveryFailure("wrong number of arguments sent to endpoint. (received: "
                    + (parms == null ? 0 : parms.length) + "; required: " + targetTypes.length + ")");
        }
        for (int i = 0; i < parms.length; i++) {
            if (parms[i] != null && !targetTypes[i].isAssignableFrom(parms[i].getClass())) {
                if (DataConversion.canConvert(targetTypes[i], parms[i].getClass())) {
                    parms[i] = DataConversion.convert(parms[i], targetTypes[i]);
                } else {
                    throw new MessageDeliveryFailure("type mismatch in method parameters");
                }
            }
        }

        try {
            method.invoke(genericSvc, parms);
        }
        catch (Exception e) {
            throw new MessageDeliveryFailure("error invoking endpoint", e);
        }
    }
View Full Code Here

                    return;
                }
            }
            sendClientError(bus, message, errorMessage, e);

            if (e != null) throw new MessageDeliveryFailure(e);
        }
        finally {
            if (disconnect) disconnectRemoteBus(bus, message);
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.errai.bus.server.MessageDeliveryFailure

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.