Example #1
0
 /// <summary>
 /// Constructor or the Inactivity Monitor
 /// </summary>
 /// <param name="next"></param>
 /// <param name="wireFormat"></param>
 public InactivityMonitor(ITransport next, StompWireFormat wireFormat)
     : base(next)
 {
     this.instanceId          = ++id;
     this.localWireFormatInfo = wireFormat;
     Tracer.DebugFormat("Creating Inactivity Monitor: {0}", instanceId);
 }
Example #2
0
        protected IWireFormat CreateWireFormat(Uri location, StringDictionary map)
        {
            object      properties    = null;
            IWireFormat wireFormatItf = null;

            // Detect STOMP etc
            if (String.Compare(location.Scheme, "stomp", true) == 0)
            {
                this.wireFormat = "STOMP";
            }

            if (String.Compare(this.wireFormat, "stomp", true) == 0)
            {
                wireFormatItf = new StompWireFormat();
                properties    = wireFormatItf;
            }
            else
            {
                OpenWireFormat openwireFormat = new OpenWireFormat();

                wireFormatItf = openwireFormat;
                properties    = openwireFormat.PreferedWireFormatInfo;
            }

            if (null != properties)
            {
                // Set wireformat. properties on the wireformat owned by the tcpTransport
                URISupport.SetProperties(properties, map, "wireFormat.");
            }

            return(wireFormatItf);
        }
    public ITransport CreateTransport(Uri location)
    {
        var socket = Connect(location.Host, location.Port);

        socket.ReceiveBufferSize = _stompConnectionSettings.TransportSettings.ReceiveBufferSize;
        socket.SendBufferSize    = _stompConnectionSettings.TransportSettings.SendBufferSize;
        socket.ReceiveTimeout    = _stompConnectionSettings.TransportSettings.ReceiveTimeout;
        socket.SendTimeout       = _stompConnectionSettings.TransportSettings.SendTimeout;

        var wireFormat = new StompWireFormat
        {
            SkipDestinationNameFormatting = _stompConnectionSettings.SkipDestinationNameFormatting,
            SetHostHeader      = _stompConnectionSettings.SetHostHeader,
            HostHeaderOverride = _stompConnectionSettings.HostHeaderOverride
        };

        var transport = CreateTransport(location, socket, wireFormat);

        wireFormat.Transport = transport;

        if (_stompConnectionSettings.TransportSettings.UseLogging)
        {
            transport = new LoggingTransport(transport);
        }

        if (_stompConnectionSettings.TransportSettings.UseInactivityMonitor)
        {
            transport = new InactivityMonitor(transport, wireFormat);
        }

        transport = new MutexTransport(transport);
        transport = new ResponseCorrelator(transport);

        return(transport);
    }
Example #4
0
 public override void BeforeMarshall(StompWireFormat wireFormat)
 {
     MarshalledProperties = null;
     if (properties != null)
     {
         MarshalledProperties = properties.Marshal();
     }
 }
Example #5
0
 public virtual void BeforeMarshall(StompWireFormat wireFormat)
 {
     /*
      * TODO: Properties
      * MarshalledProperties = null;
      * if ( _properties != null )
      *  MarshalledProperties = _properties.Marshal();
      */
 }
Example #6
0
        public override void BeforeMarshall(StompWireFormat wireFormat)
        {
            base.BeforeMarshall(wireFormat);

            if (this.Content == null && text != null)
            {
                this.Content = wireFormat.Encoder.GetBytes(this.text);
                this.text    = null;
            }
        }
Example #7
0
 /// <summary>
 ///     Method invoked when the instance gets disposed.
 /// </summary>
 protected override void Disposed()
 {
     lock ( _monitor )
     {
         _localWireFormatInfo  = null;
         _remoteWireFormatInfo = null;
         _disposing            = true;
         StopMonitorThreads();
     }
 }
Example #8
0
        public override void BeforeMarshall(StompWireFormat wireFormat)
        {
            base.BeforeMarshall(wireFormat);

            if (Content != null || _text == null)
            {
                return;
            }
            Content = wireFormat.Encoding.GetBytes(_text);
            _text   = null;
        }
Example #9
0
        public override void BeforeMarshall(StompWireFormat wireFormat)
        {
            base.BeforeMarshall(wireFormat);

            if (body == null)
            {
                this.Content = null;
            }
            else
            {
                this.Content = wireFormat.MapMarshaler.Marshal(body);
            }
        }
Example #10
0
        protected IWireFormat CreateWireFormat(StringDictionary map)
        {
            object      properties    = null;
            IWireFormat wireFormatItf = null;

            wireFormatItf = new StompWireFormat();
            properties    = wireFormatItf;

            if (null != properties)
            {
                // Set wireformat. properties on the wireformat owned by the tcpTransport
                URISupport.SetProperties(properties, map, "wireFormat.");
            }

            return(wireFormatItf);
        }
Example #11
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                // get rid of unmanaged stuff
            }

            lock (monitor)
            {
                this.localWireFormatInfo  = null;
                this.remoteWireFormatInfo = null;
                this.disposing            = true;
                StopMonitorThreads();
            }

            base.Dispose(disposing);
        }
Example #12
0
        public ITransport CompositeConnect(Uri location, SetTransport setTransport)
        {
            // Extract query parameters from broker Uri
            StringDictionary map = URISupport.ParseQuery(location.Query);

            // Set transport. properties on this (the factory)
            URISupport.SetProperties(this, map, "transport.");

            Tracer.Debug("Opening socket to: " + location.Host + " on port: " + location.Port);
            Socket socket = Connect(location.Host, location.Port);

#if !NETCF
            socket.ReceiveBufferSize = ReceiveBufferSize;
            socket.SendBufferSize    = SendBufferSize;
            socket.ReceiveTimeout    = ReceiveTimeout;
            socket.SendTimeout       = SendTimeout;
#endif

            StompWireFormat wireformat = new StompWireFormat();
            // Set wireformat. properties on the wireformat owned by the tcpTransport
            URISupport.SetProperties(wireformat, map, "wireFormat.");
            ITransport transport = DoCreateTransport(location, socket, wireformat);

            wireformat.Transport = transport;

            if (UseLogging)
            {
                transport = new LoggingTransport(transport);
            }

            if (UseInactivityMonitor)
            {
                transport = new InactivityMonitor(transport, wireformat);
            }

            if (setTransport != null)
            {
                setTransport(transport, location);
            }

            return(transport);
        }
Example #13
0
        protected IWireFormat CreateWireFormat(Uri location, System.Collections.Specialized.StringDictionary map)
        {
            // TODO detect STOMP etc
            if ("stomp".Equals(location.Scheme))
            {
                IWireFormat answer = new StompWireFormat();

                // Set wireformat. properties on the wireformat owned by the tcpTransport
                URISupport.SetProperties(answer, map, "wireFormat.");
                return(answer);
            }
            else
            {
                OpenWireFormat answer = new OpenWireFormat();

                // Set wireformat. properties on the wireformat owned by the tcpTransport
                URISupport.SetProperties(answer.PreferedWireFormatInfo, map, "wireFormat.");
                return(answer);
            }
        }
Example #14
0
 /// <summary>
 ///     Constructor or the Inactivity Monitor
 /// </summary>
 /// <param name="next"></param>
 /// <param name="wireFormat"></param>
 public InactivityMonitor(ITransport next, StompWireFormat wireFormat)
     : base(next)
 {
     _instanceId          = ++_id;
     _localWireFormatInfo = wireFormat;
 }
Example #15
0
 public virtual void BeforeUnmarshall(StompWireFormat wireFormat)
 {
 }
				protected IWireFormat CreateWireFormat(Uri location, System.Collections.Specialized.StringDictionary map)
				{
					// TODO detect STOMP etc
					if ("stomp".Equals(location.Scheme)) 
					{
						IWireFormat answer = new StompWireFormat();

	                    // Set wireformat. properties on the wireformat owned by the tcpTransport
	                    URISupport.SetProperties(answer, map, "wireFormat.");
						return answer;
					}
					else 
					{
						OpenWireFormat answer = new OpenWireFormat();

	                    // Set wireformat. properties on the wireformat owned by the tcpTransport
	                    URISupport.SetProperties(answer.PreferedWireFormatInfo, map, "wireFormat.");
						return answer;
					}
				}
Example #17
0
 public virtual void AfterUnmarshall(StompWireFormat wireFormat)
 {
 }
Example #18
0
 public virtual void SetMarshalledForm(StompWireFormat wireFormat, byte[] data)
 {
 }
Example #19
0
 public virtual byte[] GetMarshalledForm(StompWireFormat wireFormat)
 {
     return(null);
 }
Example #20
0
        public override void BeforeMarshall(StompWireFormat wireFormat)
        {
            base.BeforeMarshall(wireFormat);

            this.Content = body == null ? null : wireFormat.MapMarshaler.Marshal(body);
        }