2013-02-18 92 views

回答

0

骆驼队列可以发布到使用以下

public DirectJMSRemotingClient() throws JMSException { 
    factory = new ActiveMQConnectionFactory(brokerURL); 
    connection = factory.createConnection(); 
    connection.start(); 
    session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); 
    Destination destination = session.createQueue("queueName"); 
    producer = session.createProducer(destination); 
} 

public void sendMessage() throws JMSException { 

    TextMessage myTextMsg = session.createTextMessage(); 

    myTextMsg.setText("Hello World"); 
    System.out.println("Sending Message: " + myTextMsg.getText()); 
    producer.send(myTextMsg); 
} 

public static void main(String[] args) throws Exception { 
    DirectJMSRemotingClient client = new DirectJMSRemotingClient(); 
    client.sendMessage(); 
}  

和路由可以在骆驼这样

<route> 
     <from uri="jms:queue:queueName" /> 
     <setExchangePattern pattern="InOut" /> 
     <to uri="seda:camel-handler" /> 
    </route> 
定义