1 17 package org.apache.servicemix.client; 18 19 import javax.jbi.messaging.InOnly; 20 import javax.jbi.messaging.InOptionalOut; 21 import javax.jbi.messaging.InOut; 22 import javax.jbi.messaging.MessageExchange; 23 import javax.jbi.messaging.MessagingException; 24 import javax.jbi.messaging.RobustInOnly; 25 26 import org.apache.servicemix.jbi.resolver.URIResolver; 27 28 32 public class DefaultDestination implements Destination { 33 34 private ServiceMixClient client; 35 private String destinationUri; 36 37 public DefaultDestination(ServiceMixClient client, String destinationUri) throws MessagingException { 38 this.client = client; 39 this.destinationUri = destinationUri; 40 } 41 42 public InOnly createInOnlyExchange() throws MessagingException { 43 InOnly answer = client.createInOnlyExchange(); 44 configure(answer); 45 return answer; 46 } 47 48 public InOptionalOut createInOptionalOutExchange() throws MessagingException { 49 InOptionalOut answer = client.createInOptionalOutExchange(); 50 configure(answer); 51 return answer; 52 } 53 54 public InOut createInOutExchange() throws MessagingException { 55 InOut answer = client.createInOutExchange(); 56 configure(answer); 57 return answer; 58 } 59 60 public RobustInOnly createRobustInOnlyExchange() throws MessagingException { 61 RobustInOnly answer = client.createRobustInOnlyExchange(); 62 configure(answer); 63 return answer; 64 } 65 66 public Message createInOnlyMessage() throws MessagingException { 67 return (Message) createInOnlyExchange().getInMessage(); 68 } 69 70 protected void configure(MessageExchange exchange) throws MessagingException { 71 URIResolver.configureExchange(exchange, client.getContext(), destinationUri); 72 } 73 74 } 75 | Popular Tags |