Package javax.jbi.messaging

Examples of javax.jbi.messaging.MessageExchange$Role


            createEndpointStats(container, endpoint);
        }
    }

    protected void onExchangeSent(ExchangeEvent event) {
        MessageExchange me = event.getExchange();
        // This is a new exchange sent by a consumer
        if (me.getStatus() == ExchangeStatus.ACTIVE
                && me.getRole() == Role.CONSUMER
                && me.getMessage("out") == null
                && me.getFault() == null
                && me instanceof MessageExchangeImpl) {
            MessageExchangeImpl mei = (MessageExchangeImpl) me;
            String source = (String) me.getProperty(JbiConstants.SENDER_ENDPOINT);
            if (source == null) {
                source = mei.getSourceId().getName();
                ComponentStats stats = componentStats.get(source);
                stats.incrementOutbound();
            } else {
View Full Code Here


            }
        }
    }
   
    protected void onExchangeAccepted(ExchangeEvent event) {
        MessageExchange me = event.getExchange();
        // This is a new exchange sent by a consumer
        if (me.getStatus() == ExchangeStatus.ACTIVE
                && me.getRole() == Role.PROVIDER
                && me.getMessage("out") == null
                && me.getFault() == null
                && me instanceof MessageExchangeImpl) {
            String source = EndpointSupport.getUniqueKey(me.getEndpoint());
            EndpointStats stats = endpointStats.get(source);
            stats.incrementInbound();
        }       
    }
View Full Code Here

    public void run() {
        try {
            while (running) {
                DeliveryChannel deliveryChannel = context.getDeliveryChannel();
                System.out.println("about to do an accept on deliveryChannel: " + deliveryChannel);
                MessageExchange messageExchange = deliveryChannel.accept();
                System.out.println("received me: " + messageExchange);
                onMessageExchange(messageExchange);
            }
        }
        catch (MessagingException e) {
View Full Code Here

     */
    public void run() {
        try {
            DeliveryChannel deliveryChannel = getDeliveryChannel();
            while (!stop.get()) {
                MessageExchange exchange = deliveryChannel.accept();
                if (exchange != null) {
                    try {
                        onMessageExchange(exchange);
                    } catch (MessagingException e) {
                        log.error("MessageExchange processing failed", e);
View Full Code Here

     * @return MessageExchange
     * @throws MessagingException
     */
    public MessageExchange createExchange(URI pattern) throws MessagingException {
        checkNotClosed();
        MessageExchange result = null;
        if (pattern != null) {
            if (pattern.equals(MessageExchangeSupport.IN_ONLY)) {
                result = createInOnlyExchange();
            }
            else if (pattern.equals(MessageExchangeSupport.IN_OUT)) {
View Full Code Here

        this.meListener = new Thread(new Runnable() {
            public void run() {
                try {
                    DeliveryChannel channel = AbstractComponent.this.context.getDeliveryChannel();
                    while (true) {
                        final MessageExchange me = channel.accept();
                        if (me.isTransacted()) {
                            TransactionManager mgr = (TransactionManager) AbstractComponent.this.context.getTransactionManager();
                            Transaction tx = (Transaction) me.getProperty(MessageExchange.JTA_TRANSACTION_PROPERTY_NAME);
                            if (tx == mgr.getTransaction()) {
                                mgr.suspend();
                            }
                        }
                        AbstractComponent.this.workManager.scheduleWork(new Work() {
                            public void release() {
                            }
                            public void run() {
                                try {
                                    if (me.isTransacted()) {
                                        TransactionManager mgr = (TransactionManager) AbstractComponent.this.context.getTransactionManager();
                                        Transaction tx = (Transaction) me.getProperty(MessageExchange.JTA_TRANSACTION_PROPERTY_NAME);
                                        mgr.resume(tx);
                                    }
                                    AbstractComponent.this.process(me);
                                } catch (Exception e) {
                                    logger.error("Error processing message", e);
View Full Code Here

            String name = declaration.getIdentifier();
            Object value = tuple.get(declaration);
            variableContext.setVariableValue(name, value);
        }
        NormalizedMessage message = (NormalizedMessage) findFirst(memory, NormalizedMessage.class);
        MessageExchange exchange = (MessageExchange) findFirst(memory, MessageExchange.class);

        try {
            return expression.matches(exchange, message);
        }
        catch (MessagingException e) {
View Full Code Here

    protected boolean transform(MessageExchange exchange,
                                NormalizedMessage in,
                                NormalizedMessage out) throws MessagingException {
        NormalizedMessage curIn = in;
        MessageExchange curExchange = exchange;
        for (int i = 0; i < services.length; i++) {
            MessageExchange mexchange = this.getDeliveryChannel()
                    .createExchangeFactoryForService(services[i])
                    .createInOutExchange();
            copyProperties(curExchange, mexchange);
            curIn = invokeService(mexchange, curIn, services[i]);
            curExchange = mexchange;
View Full Code Here

        QName service = getQNameAttribute(namespaceContext, element, "service");
        QName interfaceName = getQNameAttribute(namespaceContext, element, "interface");
        QName operation = getQNameAttribute(namespaceContext, element, "operation");

        MessageExchange exchange = getExchange(context, element);
        NormalizedMessage in = getInMessage(context, element);

        // TODO we should allow nested setOutProperty tags

        component.invoke(exchange, in, service, interfaceName, operation);
View Full Code Here

   */
  public void run() {
    deliveryActive = true;
    while (deliveryActive) {
      try {
        MessageExchange exchange = channel.accept(5000);
        if (exchange != null) {
          registry.routeExchange(exchange);
        }
      } catch (Exception e) {
        e.printStackTrace();
View Full Code Here

TOP

Related Classes of javax.jbi.messaging.MessageExchange$Role

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.