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

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


            } // end if
            //
           
            return tuscanyMsg;
        } catch (JMSException e) {
            throw new JMSBindingException(e);
        } catch (NamingException e) {
            throw new JMSBindingException(e);
    }
    } // end method invokeRequest
View Full Code Here


    }

    protected void createConnection() throws NamingException, JMSException {
        Object o  = jndiLookUp(connectionFactoryName);
        if (o == null) {
            throw new JMSBindingException("connection factory not found: " + connectionFactoryName);
        }
      if (!(o instanceof ConnectionFactory)) {
        throw new JMSBindingException("JNDI resource '" + connectionFactoryName +"' is not a JMS ConnectionFactory");
      }
        ConnectionFactory connectionFactory = (ConnectionFactory)o;
        connection = connectionFactory.createConnection();
    }
View Full Code Here

    public Connection getResponseConnection() throws NamingException, JMSException {
        if (responseConnection == null) {
            if (responseConnectionFactoryName != null) {
                ConnectionFactory connectionFactory = (ConnectionFactory)jndiLookUp(responseConnectionFactoryName);
                if (connectionFactory == null) {
                    throw new JMSBindingException("connection factory not found: " + responseConnectionFactoryName);
                }
                responseConnection = connectionFactory.createConnection();
            } else {
                // if no response connection is defined in the SCDL use the request connection
                responseConnection = getConnection();
View Full Code Here

    if ( o == null )
      return null;
    else if (o instanceof ActivationSpec)
      return (ActivationSpec) o;
   
    throw new JMSBindingException("Incorrect resource type for ActivationSpec: " + o.getClass().getName());
  }
View Full Code Here

        try {

            return message.getStringProperty(operationPropertyName);

        } catch (JMSException e) {
            throw new JMSBindingException("Exception retreiving operation name from message", e);
        }
    }
View Full Code Here

        try {
            if (message != null) {
                message.setStringProperty(operationPropertyName, operationName);
            }
        } catch (JMSException e) {
            throw new JMSBindingException("Exception setting the operation name on message", e);
        }
    }
View Full Code Here

                } else {
                    return new InvocationTargetException((Throwable) exc);
                }
            }
        } catch (JMSException e) {
            throw new JMSBindingException(e);
        }
        return extractPayload(msg);
    }
View Full Code Here

            }
            message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true);
            return message;

        } catch (JMSException e) {
            throw new JMSBindingException(e);
        }
    }
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

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

            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;
            } // end if

            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();
        } // end try
  } // end method processResponse 
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.