1 /* 2 Licensed under the Apache License, Version 2.0 (the "License"); 3 you may not use this file except in compliance with the License. 4 You may obtain a copy of the License at 5 6 http://www.apache.org/licenses/LICENSE-2.0 7 8 Unless required by applicable law or agreed to in writing, software 9 distributed under the License is distributed on an "AS IS" BASIS, 10 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 See the License for the specific language governing permissions and 12 limitations under the License. 13 */ 14 package uk.nhs.interoperability.transport; 15 16 import uk.nhs.interoperability.infrastructure.ITKMessagingException; 17 import uk.nhs.interoperability.payload.ITKMessage; 18 import uk.nhs.interoperability.source.ITKMessageSender; 19 20 /** 21 * Interface that represents the transport neutral interface for sending ITK messages to a remote 22 * destination. The interface provides both synchronous and asynchronous operations where 23 * <quote>synchronous</quote> and <quote>asynchronous</quote> represent the perspective of the 24 * the application rather than necessarily the one or more underlying transport hops. 25 * 26 * @author Michael Odling-Smee 27 * @author Nicholas Jones 28 * @since version 0.1 29 * 30 */ 31 public interface ITKSender { 32 33 /** 34 * Operation that allows a business payload and ITK wrappers (e.g. DistributionEnvelope) 35 * to be sent to the destination service/system via the transport specific 36 * implementation.<br/><br/> 37 * 38 * Expected to be used in conjunction with {@link ITKMessageSender#send(ITKMessage)} for 39 * the specific transport associated with the service 40 * 41 * @param destination The {@link ITKTransportRoute} providing the transport invocation 42 * path for this operation 43 * 44 * @param request This is the ITK Wrapped message that is being sent. 45 * 46 * @exception ITKMessagingException If the <code>destination</code> is <code>null</null>, 47 * the <code>request</code> is <code>null</null>, or if there is transport timeout or error 48 * or if there is a technical exception invoking the service provider (for instance if a SOAP 49 * fault is returned by the service provider) 50 */ 51 public void send(ITKTransportRoute destination, ITKMessage request) throws ITKMessagingException; 52 53 /** 54 * Operation that allows a business payload and ITK wrappers (e.g. DistributionEnvelope) 55 * to be sent synchronously to the destination service/system via the transport specific 56 * implementation.<br/><br/> 57 * 58 * Expected to be used in conjunction with {@link ITKMessageSender#sendSync(ITKMessage)} for 59 * the specific transport associated with the service. 60 * 61 * @param destination The {@link ITKTransportRoute} providing the transport invocation 62 * path for this operation 63 * 64 * @param request This is the ITK Wrapped message that is being sent. 65 * 66 * @exception ITKMessagingException If the <code>destination</code> is <code>null</null>, 67 * the <code>request</code> is <code>null</null>, or if there is transport timeout or error 68 * or if there is a technical exception invoking the service provider (for instance if a SOAP 69 * fault is returned by the service provider) 70 */ 71 public ITKMessage sendSync(ITKTransportRoute destination, ITKMessage request) throws ITKMessagingException; 72 73 /** 74 * Operation that allows a business payload and ITK wrappers (e.g. DistributionEnvelope) 75 * to be sent asynchronously to the destination service/system via the transport specific 76 * implementation.<br/><br/> 77 * 78 * Expected to be used in conjunction with {@link ITKMessageSender#sendAsync(ITKMessage)} for 79 * the specific transport associated with the service. 80 * 81 * @param destination The {@link ITKTransportRoute} providing the transport invocation 82 * path for this operation 83 * 84 * @param request This is the ITK Wrapped message that is being sent. 85 * 86 * @exception ITKMessagingException If the <code>destination</code> is <code>null</null>, 87 * the <code>request</code> is <code>null</null>, or if there is transport timeout or error 88 * or if there is a technical exception invoking the transport for the first leg 89 * of the routed message's path to the service provider (depending on the deployment landscape this 90 * could be an exception returned by the service provider if there is only one leg for the routed 91 * message) 92 */ 93 public void sendAysnc(ITKTransportRoute destination, ITKMessage request) throws ITKMessagingException; 94 95 }