Example #1
0
        public virtual IAsyncTransmitterEndpoint GetEndpoint(IBaseMessage message)
        {
            // Provide a virtual "CreateEndpointParameters" method to map message to endpoint
            EndpointParameters endpointParameters = CreateEndpointParameters(message);

            lock (_endpoints)
            {
                IAsyncTransmitterEndpoint endpoint;

                if (_endpoints.TryGetValue(endpointParameters.SessionKey, out endpoint))
                {
                    return(endpoint);
                }
                //  we haven't seen this location so far this batch so make a new endpoint
                endpoint = (IAsyncTransmitterEndpoint)Activator.CreateInstance(EndpointType, this);

                endpoint.Open(endpointParameters, HandlerPropertyBag, PropertyNamespace);

                if (endpoint.ReuseEndpoint())
                {
                    _endpoints[endpointParameters.SessionKey] = endpoint;
                }
                return(endpoint);
            }
        }
Example #2
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);
            }
        }
Example #3
0
 public abstract void Open(EndpointParameters endpointParameters, IPropertyBag handlerPropertyBag, string propertyNamespace);