Пример #1
0
        public virtual AsyncTransmitterEndpoint GetEndpoint(IBaseMessage message)
        {
            // Provide a virtual "CreateEndpointParameters" method to map message to endpoint
            EndpointParameters endpointParameters = CreateEndpointParameters(message);

            lock (endpoints)
            {
                AsyncTransmitterEndpoint endpoint = (AsyncTransmitterEndpoint)endpoints[endpointParameters.SessionKey];
                if (null == endpoint)
                {
                    //  we haven't seen this location so far this batch so make a new endpoint
                    endpoint = (AsyncTransmitterEndpoint)Activator.CreateInstance(this.endpointType, new object[] { this });

                    if (null == endpoint)
                    {
                        throw new CreateEndpointFailed(this.endpointType.FullName, endpointParameters.OutboundLocation);
                    }

                    endpoint.Open(endpointParameters, this.HandlerPropertyBag, this.PropertyNamespace);

                    if (endpoint.ReuseEndpoint)
                    {
                        endpoints[endpointParameters.SessionKey] = endpoint;
                    }
                }
                return(endpoint);
            }
        }
 public abstract void Open(EndpointParameters endpointParameters, IPropertyBag handlerPropertyBag, string propertyNamespace);