Package org.apache.tuscany.sca.binding.jms

Examples of org.apache.tuscany.sca.binding.jms.JMSBindingException


            }

            return message;

        } catch (JMSException e) {
            throw new JMSBindingException(e);
        }
    }
View Full Code Here


                message.setText(domHelper.saveAsString((Node)((FaultException)o).getFaultInfo()));
                message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true);
                return message;

            } catch (JMSException e) {
                throw new JMSBindingException(e);
            }
        } else {
            return super.createFaultMessage(session, o);
        }
    }
View Full Code Here

    public synchronized Session getJmsSession() {
        if (jmsSession == null) {
            try {
                jmsSession = getJmsResourceFactory().createSession();
            } catch (Exception e) {
                throw new JMSBindingException(e);
            }
        }
        return jmsSession;
    }
View Full Code Here

    public synchronized void closeJmsSession() {
        if (jmsSession != null) {
            try {
                getJmsResourceFactory().closeSession(jmsSession);
            } catch (Exception e) {
                throw new JMSBindingException(e);
            } finally {
                jmsSession = null;
            }
        }
    }
View Full Code Here

    public synchronized Session getJmsResponseSession() {
        if (jmsResponseSession == null) {
            try {
                jmsResponseSession = getJmsResourceFactory().createResponseSession();
            } catch (Exception e) {
                throw new JMSBindingException(e);
            }
        }
        return jmsResponseSession;
    }
View Full Code Here

    public synchronized void closeJmsResponseSession() {
        if (jmsResponseSession != null) {
            try {
                getJmsResourceFactory().closeResponseSession(jmsResponseSession);
            } catch (Exception e) {
                throw new JMSBindingException(e);
            } finally {
                jmsResponseSession = null;
            }
        }
    }
View Full Code Here

            if (replyDest == null) {
                if (jmsBinding.getResponseDestinationName() != null) {
                    try {
                        replyDest = jmsResourceFactory.lookupDestination(jmsBinding.getResponseDestinationName());
                    } catch (NamingException e) {
                        throw new JMSBindingException("Exception lookingup response destination", e);
                    }
                }
            }

            if (replyDest == null) {
                // assume no reply is expected
                if (msg.getBody() != null) {
                    logger.log(Level.FINE, "JMS service '" + service.getName() + "' dropped response as request has no replyTo");
                }
                return msg;
            }

            if ((msg.getOperation() != null)) {
                String operationName = msg.getOperation().getName();
                if (jmsBinding.getEffectiveJMSPriority(operationName) != null) {
                    responseJMSMsg.setJMSPriority(jmsBinding.getEffectiveJMSPriority(operationName));
                }
       
                if ( jmsBinding.getEffectiveJMSType(operationName) != null) {
                    responseJMSMsg.setJMSType(jmsBinding.getEffectiveJMSType(operationName));
                }
               
                if ((jmsBinding.getEffectiveJMSDeliveryMode(operationName) != null)) {
                    responseJMSMsg.setJMSDeliveryMode(jmsBinding.getEffectiveJMSDeliveryMode(operationName) ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);                  
                }
               
                if ((jmsBinding.getEffectiveJMSTimeToLive(operationName) != null)) {
                  responseJMSMsg.setJMSExpiration(jmsBinding.getEffectiveJMSTimeToLive(operationName).longValue());
                }
            }
   
            if (correlationScheme == null ||
                JMSBindingConstants.CORRELATE_MSG_ID.equalsIgnoreCase(correlationScheme)) {
                responseJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSMessageID());
            } else if (JMSBindingConstants.CORRELATE_CORRELATION_ID.equalsIgnoreCase(correlationScheme)) {
                responseJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSCorrelationID());
            }               
                      
            MessageProducer producer = session.createProducer(replyDest);
           
            // Set jms header attributes in producer, not message.
            int deliveryMode = requestJMSMsg.getJMSDeliveryMode();
            producer.setDeliveryMode(deliveryMode);
            int deliveryPriority = requestJMSMsg.getJMSPriority();
            producer.setPriority(deliveryPriority);
            long timeToLive = requestJMSMsg.getJMSExpiration();
            producer.setTimeToLive(timeToLive);
   
            producer.send((javax.jms.Message)msg.getBody());
   
            producer.close();
           
            return msg;
   
        } catch (JMSException e) {
            throw new JMSBindingException(e);
        } finally {
            context.closeJmsResponseSession();
        }
    }   
View Full Code Here

            } finally {
                producer.close();
            }
            return msg;
        } catch (JMSException e) {
            throw new JMSBindingException(e);
        }
    }
View Full Code Here

                replyMsg = consumer.receive(context.getTimeToLive());
            } finally {
                consumer.close();
            }
            if (replyMsg == null) {
                throw new JMSBindingException("No reply message received on " +
                                              context.getReplyToDestination() +
                                              " for message id " +
                                              requestMessage.getJMSMessageID());
            }
           
            msg.setBody(replyMsg);
            return msg;
        } catch (JMSException e) {
            throw new JMSBindingException(e);
        } catch (NamingException e) {
            throw new JMSBindingException(e);
        } finally {
            try {
                context.closeJmsResponseSession();
                if (jmsResourceFactory.isConnectionClosedAfterUse())
                    jmsResourceFactory.closeResponseConnection();
View Full Code Here

           
            requestMsg.setJMSReplyTo(context.getReplyToDestination());
           
            return msg;
        } catch (JMSException e) {
            throw new JMSBindingException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.binding.jms.JMSBindingException

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.