/** * @param theMessage message for which a destination is looked up * @param theRoutingData routing data * @return the application from the binding with a WILDCARD match, if one exists */ private <T extends Message> ReceivingApplication<T> findDestination(T theMessage, AppRoutingData theRoutingData) { ReceivingApplication<? extends Message> result = null; for (int i = 0; i < myBindings.size() && result == null; i++) { Binding binding = myBindings.get(i); if (matches(theRoutingData, binding.routingData) && binding.active) { if (theMessage == null || ((ReceivingApplication<T>)binding.application).canProcess(theMessage)) { result = binding.application; } } } return (ReceivingApplication<T>)result; }
/** * @param theMessage message for which a destination is looked up * @param theRoutingData routing data * @return the application from the binding with a WILDCARD match, if one exists */ private <T extends Message> ReceivingApplication<T> findDestination(T theMessage, AppRoutingData theRoutingData) { ReceivingApplication<? extends Message> result = null; for (int i = 0; i < myBindings.size() && result == null; i++) { Binding binding = myBindings.get(i); if (matches(theRoutingData, binding.routingData) && binding.active) { if (theMessage == null || ((ReceivingApplication<T>)binding.application).canProcess(theMessage)) { result = binding.application; } } } return (ReceivingApplication<T>)result; }
/** * @param theMessageData routing data related to a particular message * @param theReferenceData routing data related to a binding, which may include * wildcards * @return true if the message data is consist with the reference data, ie all * values either match or are wildcards in the reference */ public static boolean matches(AppRoutingData theMessageData, AppRoutingData theReferenceData) { boolean result = false; if (matches(theMessageData.getMessageType(), theReferenceData.getMessageType()) && matches(theMessageData.getTriggerEvent(), theReferenceData.getTriggerEvent()) && matches(theMessageData.getProcessingId(), theReferenceData.getProcessingId()) && matches(theMessageData.getVersion(), theReferenceData.getVersion())) { result = true; } return result; }
/** * @param theMessageData routing data related to a particular message * @param theReferenceData routing data related to a binding, which may include * wildcards * @return true if the message data is consist with the reference data, ie all * values either match or are wildcards in the reference */ public static boolean matches(AppRoutingData theMessageData, AppRoutingData theReferenceData) { boolean result = false; if (matches(theMessageData.getMessageType(), theReferenceData.getMessageType()) && matches(theMessageData.getTriggerEvent(), theReferenceData.getTriggerEvent()) && matches(theMessageData.getProcessingId(), theReferenceData.getProcessingId()) && matches(theMessageData.getVersion(), theReferenceData.getVersion())) { result = true; } return result; }