1 17 package org.apache.servicemix.components.jms; 18 19 import javax.jbi.messaging.MessageExchange; 20 import javax.jms.Destination ; 21 22 28 public class SimpleDestinationChooser implements DestinationChooser { 29 public static final String OUT_DESTINATION_KEY = "org.apache.servicemix.binding.jms.out.destination"; 30 31 private Destination defaultDestination; 32 33 public SimpleDestinationChooser() { 34 } 35 36 public SimpleDestinationChooser(Destination defaultDestination) { 37 this.defaultDestination = defaultDestination; 38 } 39 40 public Destination chooseDestination(MessageExchange messageExchange) { 41 Object property = messageExchange.getProperty(OUT_DESTINATION_KEY); 42 if (property instanceof Destination ) { 43 return (Destination ) property; 44 } 45 return getDefaultDestination(); 46 } 47 48 public Destination getDefaultDestination() { 51 return defaultDestination; 52 } 53 54 public void setDefaultDestination(Destination defaultDestination) { 55 this.defaultDestination = defaultDestination; 56 } 57 58 } 59 | Popular Tags |