public void Initialize(IProcessorServiceForAction processorService)
 {
     this.processorService = processorService;
     targetEndpoint = new EndpointAddress(targetGatewayName, targetAdapterName, targetEndpointName);
 }
Exemple #2
0
        public SerializableXDocument SendMessage(EndpointAddress address, SerializableXDocument message, SerializableXDocument metadata)
        {
            if (!AdaptersByName.ContainsKey(address.AdapterName)) {
                throw new ArgumentException(string.Format(
                    "There is no adapter named '{0}' in gateway '{1}'.",
                    address.AdapterName, Name), "address");
            }

            Adapter adapter = AdaptersByName[address.AdapterName];
            XDocument result = adapter.SendMessage(address.EndpointName, message.XDocument, metadata.XDocument);
            return new SerializableXDocument(result);
        }
Exemple #3
0
 /// <summary>
 /// Obtains the address of source endpoint which the input message
 /// originated from.
 /// </summary>
 /// <remarks>This method is synchronized and can block.</remarks>
 /// <paparam name="sourceAddress">Address of the original
 /// gateway/adapter/endpoint</paparam>
 public void SetSourceAddress(EndpointAddress sourceAddress)
 {
     lock (SyncLock) {
         var xSourceAddress = Content.XDocument.XPathSelectElement("token/source-address");
         if (xSourceAddress == null) {
             xSourceAddress = new XElement("source-address");
             Content.XDocument.XPathSelectElement("token").Add(xSourceAddress);
         }
         xSourceAddress.SetAttributeValue("gateway", sourceAddress.GatewayName);
         xSourceAddress.SetAttributeValue("adapter", sourceAddress.AdapterName);
         xSourceAddress.SetAttributeValue("endpoint", sourceAddress.EndpointName);
     }
 }
Exemple #4
0
 public SerializableXDocument SendMessageToOutputEndPoint(EndpointAddress address, SerializableXDocument message, SerializableXDocument metadata)
 {
     SerializableXDocument result = gateway.SendMessage(address, message, metadata);
     return result;
 }
 /// <summary>
 /// Sends an output message to specified output endpoint.
 /// </summary>
 /// <param name="target">output endpoint address</param>
 /// <param name="message">output message content</param>
 /// <param name="metadata">output message metadata; can be null</param>
 /// <returns></returns>
 public XDocument SendMessage(EndpointAddress target, XDocument message, XDocument metadata = null)
 {
     var result = BrokerService.SendMessage(target, new SerializableXDocument(message), new SerializableXDocument(metadata));
     return result.XDocument;
 }