/// <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); }
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); }
public override void BeforeMarshall(StompWireFormat wireFormat) { MarshalledProperties = null; if (properties != null) { MarshalledProperties = properties.Marshal(); } }
public virtual void BeforeMarshall(StompWireFormat wireFormat) { /* * TODO: Properties * MarshalledProperties = null; * if ( _properties != null ) * MarshalledProperties = _properties.Marshal(); */ }
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; } }
/// <summary> /// Method invoked when the instance gets disposed. /// </summary> protected override void Disposed() { lock ( _monitor ) { _localWireFormatInfo = null; _remoteWireFormatInfo = null; _disposing = true; StopMonitorThreads(); } }
public override void BeforeMarshall(StompWireFormat wireFormat) { base.BeforeMarshall(wireFormat); if (Content != null || _text == null) { return; } Content = wireFormat.Encoding.GetBytes(_text); _text = null; }
public override void BeforeMarshall(StompWireFormat wireFormat) { base.BeforeMarshall(wireFormat); if (body == null) { this.Content = null; } else { this.Content = wireFormat.MapMarshaler.Marshal(body); } }
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); }
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); }
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); }
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); } }
/// <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; }
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; } }
public virtual void AfterUnmarshall(StompWireFormat wireFormat) { }
public virtual void SetMarshalledForm(StompWireFormat wireFormat, byte[] data) { }
public virtual byte[] GetMarshalledForm(StompWireFormat wireFormat) { return(null); }
public override void BeforeMarshall(StompWireFormat wireFormat) { base.BeforeMarshall(wireFormat); this.Content = body == null ? null : wireFormat.MapMarshaler.Marshal(body); }