//------------------------------------------------------------------------------
 //
 // Method: RemoteSenderCompressor (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.RemoteSenderCompressor class.
 /// </summary>
 /// <param name="underlyingRemoteSender">The remote sender to send the message to after compressing.</param>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public RemoteSenderCompressor(IRemoteSender underlyingRemoteSender, IApplicationLogger logger, IMetricLogger metricLogger)
     : this(underlyingRemoteSender)
 {
     this.logger      = logger;
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
 //------------------------------------------------------------------------------
 //
 // Method: RemoteSenderCompressor (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.RemoteSenderCompressor class.
 /// </summary>
 /// <param name="underlyingRemoteSender">The remote sender to send the message to after compressing.</param>
 public RemoteSenderCompressor(IRemoteSender underlyingRemoteSender)
 {
     remoteSender     = underlyingRemoteSender;
     logger           = new ConsoleApplicationLogger(LogLevel.Information, '|', "  ");
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(new NullMetricLogger());
 }
Exemplo n.º 3
0
 //------------------------------------------------------------------------------
 //
 // Method: FileRemoteReceiver (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.FileRemoteReceiver class.
 /// </summary>
 /// <param name="messageFilePath">The full path of the file used to receive messages.</param>
 /// <param name="lockFilePath">The full path of the file used to indicate when the message file is locked for writing.</param>
 /// <param name="readLoopTimeout">The time to wait between attempts to read the file in milliseconds.</param>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public FileRemoteReceiver(string messageFilePath, string lockFilePath, int readLoopTimeout, IApplicationLogger logger, IMetricLogger metricLogger)
     : this(messageFilePath, lockFilePath, readLoopTimeout)
 {
     this.logger      = logger;
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
 //------------------------------------------------------------------------------
 //
 // Method: ActiveMqRemoteSender (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.ActiveMqRemoteSender class.
 /// </summary>
 /// <param name="connectUriName">The unform resource identifier of the ActiveMQ broker to connect to.</param>
 /// <param name="queueName">The name of the queue to connect to.</param>
 /// <param name="messageFilter">The filter to apply to the queue.  Allows multiple remote senders and receivers to use the same queue by each applying their own unique filter.</param>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public ActiveMqRemoteSender(string connectUriName, string queueName, string messageFilter, IApplicationLogger logger, IMetricLogger metricLogger)
     : this(connectUriName, queueName, messageFilter)
 {
     this.logger      = logger;
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
Exemplo n.º 5
0
 //------------------------------------------------------------------------------
 //
 // Method: SoapMethodInvocationSerializer (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.SoapMethodInvocationSerializer class.
 /// </summary>
 public SoapMethodInvocationSerializer()
 {
     internalSoapFormatter = new SoapFormatter();
     serializerUtilities   = new SerializerUtilities(Encoding.UTF8);
     loggingUtilities      = new LoggingUtilities(new ConsoleApplicationLogger(LogLevel.Information, '|', "  "));
     metricsUtilities      = new MetricsUtilities(new NullMetricLogger());
 }
 //------------------------------------------------------------------------------
 //
 // Method: TcpRemoteSender (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.TcpRemoteSender class.
 /// </summary>
 /// <param name="ipAddress">The remote IP address to connect to.</param>
 /// <param name="port">The remote port to connect to.</param>
 /// <param name="connectRetryCount">The number of times to retry when initially connecting, or attempting to reconnect to a TcpRemoteReceiver.</param>
 /// <param name="connectRetryInterval">The interval between retries to connect or reconnect in milliseconds.</param>
 /// <param name="acknowledgementReceiveTimeout">The maximum time to wait for an acknowledgement of a message in milliseconds.</param>
 /// <param name="acknowledgementReceiveRetryInterval">The time between retries to check for an acknowledgement in milliseconds.</param>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public TcpRemoteSender(System.Net.IPAddress ipAddress, int port, int connectRetryCount, int connectRetryInterval, int acknowledgementReceiveTimeout, int acknowledgementReceiveRetryInterval, IApplicationLogger logger, IMetricLogger metricLogger)
     : this(ipAddress, port, connectRetryCount, connectRetryInterval, acknowledgementReceiveTimeout, acknowledgementReceiveRetryInterval)
 {
     this.logger      = logger;
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
Exemplo n.º 7
0
 //------------------------------------------------------------------------------
 //
 // Method: RemoteReceiverDecompressor (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.RemoteReceiverDecompressor class.
 /// </summary>
 /// <param name="underlyingRemoteReceiver">The remote receiver to receive the message from before compressing.</param>
 /// <param name="decompressionBufferSize">The size of the buffer to use when decompressing the message in bytes.  Denotes how much data will be read from the internal stream decompressor class in each read operation.  Should be set to match the expected decompressed message size as closely as possible.</param>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public RemoteReceiverDecompressor(IRemoteReceiver underlyingRemoteReceiver, int decompressionBufferSize, IApplicationLogger logger, IMetricLogger metricLogger)
     : this(underlyingRemoteReceiver, decompressionBufferSize)
 {
     this.logger      = logger;
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
 //------------------------------------------------------------------------------
 //
 // Method: TcpRemoteReceiver (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.TcpRemoteReceiver class.
 /// </summary>
 /// <param name="port">The port to listen for incoming connections on.</param>
 /// <param name="connectRetryCount">The number of times to retry when initially connecting, or attempting to reconnect to a TcpRemoteSender.</param>
 /// <param name="connectRetryInterval">The interval between retries to connect or reconnect in milliseconds.</param>
 /// <param name="receiveRetryInterval">The time to wait between attempts to receive a message in milliseconds.</param>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public TcpRemoteReceiver(int port, int connectRetryCount, int connectRetryInterval, int receiveRetryInterval, IApplicationLogger logger, IMetricLogger metricLogger)
     : this(port, connectRetryCount, connectRetryInterval, receiveRetryInterval)
 {
     this.logger      = logger;
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
 //------------------------------------------------------------------------------
 //
 // Method: ActiveMqRemoteSender (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.ActiveMqRemoteSender class.
 /// </summary>
 /// <param name="connectUriName">The unform resource identifier of the ActiveMQ broker to connect to.</param>
 /// <param name="queueName">The name of the queue to connect to.</param>
 /// <param name="messageFilter">The filter to apply to the queue.  Allows multiple remote senders and receivers to use the same queue by each applying their own unique filter.</param>
 public ActiveMqRemoteSender(string connectUriName, string queueName, string messageFilter)
     : base(connectUriName, queueName, messageFilter)
 {
     logger           = new ConsoleApplicationLogger(LogLevel.Information, '|', "  ");
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(new NullMetricLogger());
 }
 //------------------------------------------------------------------------------
 //
 // Method: MethodInvocationRemoteReceiver (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.MethodInvocationRemoteReceiver class.
 /// </summary>
 /// <param name="serializer">Object to use to deserialize method invocations.</param>
 /// <param name="sender">Object to use to send serialized method invocation return values.</param>
 /// <param name="receiver">Object to use to receive serialized method invocations.</param>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public MethodInvocationRemoteReceiver(IMethodInvocationSerializer serializer, IRemoteSender sender, IRemoteReceiver receiver, IApplicationLogger logger, IMetricLogger metricLogger)
     : this(serializer, sender, receiver)
 {
     this.logger = logger;
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
 //------------------------------------------------------------------------------
 //
 // Method: FileRemoteSender (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.FileRemoteSender class.
 /// </summary>
 /// <param name="messageFilePath">The full path of the file used to send messages.</param>
 /// <param name="lockFilePath">The full path of the file used to indicate when the message file is locked for writing.</param>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public FileRemoteSender(string messageFilePath, string lockFilePath, IApplicationLogger logger, IMetricLogger metricLogger)
     : this(messageFilePath, lockFilePath)
 {
     this.logger      = logger;
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
Exemplo n.º 12
0
 //------------------------------------------------------------------------------
 //
 // Method: ActiveMqRemoteReceiver (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.ActiveMqRemoteReceiver class.
 /// </summary>
 /// <param name="connectUriName">The unform resource identifier of the ActiveMQ broker to connect to.</param>
 /// <param name="queueName">The name of the queue to connect to.</param>
 /// <param name="messageFilter">The filter to apply to the queue.  Allows multiple remote senders and receivers to use the same queue by each applying their own unique filter.</param>
 /// <param name="connectLoopTimeout">The time to wait for a message before retrying in milliseconds.</param>
 public ActiveMqRemoteReceiver(string connectUriName, string queueName, string messageFilter, int connectLoopTimeout)
     : base(connectUriName, queueName, messageFilter)
 {
     this.connectLoopTimeout = connectLoopTimeout;
     logger           = new ConsoleApplicationLogger(LogLevel.Information, '|', "  ");
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(new NullMetricLogger());
 }
 //------------------------------------------------------------------------------
 //
 // Method: ActiveMqRemoteSender (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.ActiveMqRemoteSender class.  Note this is an additional constructor to facilitate unit tests, and should not be used to instantiate the class under normal conditions.
 /// </summary>
 /// <param name="connectUriName">The uniform resource identifier of the ActiveMQ broker to connect to.</param>
 /// <param name="queueName">The name of the queue to connect to.</param>
 /// <param name="messageFilter">The filter to apply to the queue.  Allows multiple remote senders and receivers to use the same queue by each applying their own unique filter.</param>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 /// <param name="testConnectionFactory">A test (mock) NMS connection factory.</param>
 /// <param name="testConnection">A test (mock) NMS connection.</param>
 /// <param name="testSession">A test (mock) NMS session.</param>
 /// <param name="testDestination">A test (mock) NMS destination.</param>
 /// <param name="testProducer">A test (mock) NMS message producer.</param>
 public ActiveMqRemoteSender(string connectUriName, string queueName, string messageFilter, IApplicationLogger logger, IMetricLogger metricLogger, IConnectionFactory testConnectionFactory, IConnection testConnection, ISession testSession, IDestination testDestination, IMessageProducer testProducer)
     : base(connectUriName, queueName, messageFilter, testConnectionFactory, testConnection, testSession, testDestination)
 {
     producer         = testProducer;
     this.logger      = logger;
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
Exemplo n.º 14
0
 //------------------------------------------------------------------------------
 //
 // Method: RemoteReceiverDecompressor (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.RemoteReceiverDecompressor class.
 /// </summary>
 /// <param name="underlyingRemoteReceiver">The remote receiver to receive the message from before decompressing.</param>
 public RemoteReceiverDecompressor(IRemoteReceiver underlyingRemoteReceiver)
 {
     this.remoteReceiver          = underlyingRemoteReceiver;
     this.decompressionBufferSize = 1024;
     logger           = new ConsoleApplicationLogger(LogLevel.Information, '|', "  ");
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(new NullMetricLogger());
 }
 //------------------------------------------------------------------------------
 //
 // Method: MethodInvocationRemoteReceiver (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.MethodInvocationRemoteReceiver class.
 /// </summary>
 /// <param name="serializer">Object to use to deserialize method invocations.</param>
 /// <param name="sender">Object to use to send serialized method invocation return values.</param>
 /// <param name="receiver">Object to use to receive serialized method invocations.</param>
 public MethodInvocationRemoteReceiver(IMethodInvocationSerializer serializer, IRemoteSender sender, IRemoteReceiver receiver)
 {
     this.serializer = serializer;
     this.sender = sender;
     this.receiver = receiver;
     logger = new ConsoleApplicationLogger(LogLevel.Information, '|', "  ");
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(new NullMetricLogger());
 }
Exemplo n.º 16
0
 //------------------------------------------------------------------------------
 //
 // Method: ActiveMqRemoteReceiver (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.ActiveMqRemoteReceiver class.  Note this is an additional constructor to facilitate unit tests, and should not be used to instantiate the class under normal conditions.
 /// </summary>
 /// <param name="connectUriName">The uniform resource identifier of the ActiveMQ broker to connect to.</param>
 /// <param name="queueName">The name of the queue to connect to.</param>
 /// <param name="messageFilter">The filter to apply to the queue.  Allows multiple remote senders and receivers to use the same queue by each applying their own unique filter.</param>
 /// <param name="connectLoopTimeout">The time to wait for a message before retrying in milliseconds.</param>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 /// <param name="testConnectionFactory">A test (mock) NMS connection factory.</param>
 /// <param name="testConnection">A test (mock) NMS connection.</param>
 /// <param name="testSession">A test (mock) NMS session.</param>
 /// <param name="testDestination">A test (mock) NMS destination.</param>
 /// <param name="testConsumer">A test (mock) NMS message consumer.</param>
 public ActiveMqRemoteReceiver(string connectUriName, string queueName, string messageFilter, int connectLoopTimeout, IApplicationLogger logger, IMetricLogger metricLogger, IConnectionFactory testConnectionFactory, IConnection testConnection, ISession testSession, IDestination testDestination, IMessageConsumer testConsumer)
     : base(connectUriName, queueName, messageFilter, testConnectionFactory, testConnection, testSession, testDestination)
 {
     this.connectLoopTimeout = connectLoopTimeout;
     consumer         = testConsumer;
     this.logger      = logger;
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
 //------------------------------------------------------------------------------
 //
 // Method: FileRemoteSender (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.FileRemoteSender class.  Note this is an additional constructor to facilitate unit tests, and should not be used to instantiate the class under normal conditions.
 /// </summary>
 /// <param name="messageFilePath">The full path of the file used to send messages.</param>
 /// <param name="lockFilePath">The full path of the file used to indicate when the message file is locked for writing.</param>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 /// <param name="messageFile">A test (mock) message file.</param>
 /// <param name="lockFile">A test (mock) lock file.</param>
 /// <param name="fileSystem">A test (mock) file system.</param>
 public FileRemoteSender(string messageFilePath, string lockFilePath, IApplicationLogger logger, IMetricLogger metricLogger, IFile messageFile, IFile lockFile, IFileSystem fileSystem)
     : this(messageFilePath, lockFilePath)
 {
     this.messageFile = messageFile;
     this.lockFile    = lockFile;
     this.fileSystem  = fileSystem;
     this.logger      = logger;
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
        //------------------------------------------------------------------------------
        //
        // Method: TcpRemoteSender (constructor)
        //
        //------------------------------------------------------------------------------
        /// <summary>
        /// Initialises a new instance of the MethodInvocationRemoting.TcpRemoteSender class.
        /// </summary>
        /// <param name="ipAddress">The remote IP address to connect to.</param>
        /// <param name="port">The remote port to connect to.</param>
        /// <param name="connectRetryCount">The number of times to retry when initially connecting, or attempting to reconnect to a TcpRemoteReceiver.</param>
        /// <param name="connectRetryInterval">The interval between retries to connect or reconnect in milliseconds.</param>
        /// <param name="acknowledgementReceiveTimeout">The maximum time to wait for an acknowledgement of a message in milliseconds.</param>
        /// <param name="acknowledgementReceiveRetryInterval">The time between retries to check for an acknowledgement in milliseconds.</param>
        public TcpRemoteSender(System.Net.IPAddress ipAddress, int port, int connectRetryCount, int connectRetryInterval, int acknowledgementReceiveTimeout, int acknowledgementReceiveRetryInterval)
        {
            this.ipAddress = ipAddress;
            this.port      = port;

            if (connectRetryCount >= 0)
            {
                this.connectRetryCount = connectRetryCount;
            }
            else
            {
                throw new ArgumentOutOfRangeException("connectRetryCount", "Argument 'connectRetryCount' must be greater than or equal to 0.");
            }

            if (connectRetryInterval >= 0)
            {
                this.connectRetryInterval = connectRetryInterval;
            }
            else
            {
                throw new ArgumentOutOfRangeException("connectRetryInterval", "Argument 'connectRetryInterval' must be greater than or equal to 0.");
            }

            if (acknowledgementReceiveTimeout >= 0)
            {
                this.acknowledgementReceiveTimeout = acknowledgementReceiveTimeout;
            }
            else
            {
                throw new ArgumentOutOfRangeException("acknowledgementReceiveTimeout", "Argument 'acknowledgementReceiveTimeout' must be greater than or equal to 0.");
            }

            if (acknowledgementReceiveRetryInterval >= 0)
            {
                this.acknowledgementReceiveRetryInterval = acknowledgementReceiveRetryInterval;
            }
            else
            {
                throw new ArgumentOutOfRangeException("acknowledgementReceiveRetryInterval", "Argument 'acknowledgementReceiveRetryInterval' must be greater than or equal to 0.");
            }

            logger           = new ConsoleApplicationLogger(LogLevel.Information, '|', "  ");
            loggingUtilities = new LoggingUtilities(logger);
            metricsUtilities = new MetricsUtilities(new NullMetricLogger());
            client           = new TcpClient();

            messageSequenceNumber = 1;
            disposed = false;
        }
Exemplo n.º 19
0
        //------------------------------------------------------------------------------
        //
        // Method: FileRemoteReceiver (constructor)
        //
        //------------------------------------------------------------------------------
        /// <summary>
        /// Initialises a new instance of the MethodInvocationRemoting.FileRemoteReceiver class.
        /// </summary>
        /// <param name="messageFilePath">The full path of the file used to receive messages.</param>
        /// <param name="lockFilePath">The full path of the file used to indicate when the message file is locked for writing.</param>
        /// <param name="readLoopTimeout">The time to wait between attempts to read the file in milliseconds.</param>
        public FileRemoteReceiver(string messageFilePath, string lockFilePath, int readLoopTimeout)
        {
            if (messageFile == null)
            {
                messageFile = new File(messageFilePath);
            }
            if (fileSystem == null)
            {
                fileSystem = new FileSystem();
            }
            this.messageFilePath = messageFilePath;
            this.lockFilePath    = lockFilePath;
            this.readLoopTimeout = readLoopTimeout;

            logger           = new ConsoleApplicationLogger(LogLevel.Information, '|', "  ");
            loggingUtilities = new LoggingUtilities(logger);
            metricsUtilities = new MetricsUtilities(new NullMetricLogger());

            disposed = false;
        }
        //------------------------------------------------------------------------------
        //
        // Method: TcpRemoteReceiver (constructor)
        //
        //------------------------------------------------------------------------------
        /// <summary>
        /// Initialises a new instance of the MethodInvocationRemoting.TcpRemoteReceiver class.
        /// </summary>
        /// <param name="port">The port to listen for incoming connections on.</param>
        /// <param name="connectRetryCount">The number of times to retry when initially connecting, or attempting to reconnect to a TcpRemoteSender.</param>
        /// <param name="connectRetryInterval">The interval between retries to connect or reconnect in milliseconds.</param>
        /// <param name="receiveRetryInterval">The time to wait between attempts to receive a message in milliseconds.</param>
        public TcpRemoteReceiver(int port, int connectRetryCount, int connectRetryInterval, int receiveRetryInterval)
        {
            this.port = port;

            if (connectRetryCount >= 0)
            {
                this.connectRetryCount = connectRetryCount;
            }
            else
            {
                throw new ArgumentOutOfRangeException("connectRetryCount", "Argument 'connectRetryCount' must be greater than or equal to 0.");
            }

            if (connectRetryInterval >= 0)
            {
                this.connectRetryInterval = connectRetryInterval;
            }
            else
            {
                throw new ArgumentOutOfRangeException("connectRetryInterval", "Argument 'connectRetryInterval' must be greater than or equal to 0.");
            }

            if (receiveRetryInterval >= 0)
            {
                this.receiveRetryInterval = receiveRetryInterval;
            }
            else
            {
                throw new ArgumentOutOfRangeException("receiveRetryInterval", "Argument 'receiveRetryInterval' must be greater than or equal to 0.");
            }

            listener         = new TcpListener(System.Net.IPAddress.Any, port);
            logger           = new ConsoleApplicationLogger(LogLevel.Information, '|', "  ");
            loggingUtilities = new LoggingUtilities(logger);
            metricsUtilities = new MetricsUtilities(new NullMetricLogger());

            lastMessageSequenceNumber = 0;
            connected = false;
            disposed  = false;
        }
 //------------------------------------------------------------------------------
 //
 // Method: ActiveMqRemoteSender (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.ActiveMqRemoteSender class.
 /// </summary>
 /// <param name="connectUriName">The unform resource identifier of the ActiveMQ broker to connect to.</param>
 /// <param name="queueName">The name of the queue to connect to.</param>
 /// <param name="messageFilter">The filter to apply to the queue.  Allows multiple remote senders and receivers to use the same queue by each applying their own unique filter.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public ActiveMqRemoteSender(string connectUriName, string queueName, string messageFilter, IMetricLogger metricLogger)
     : this(connectUriName, queueName, messageFilter)
 {
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
Exemplo n.º 22
0
 //------------------------------------------------------------------------------
 //
 // Method: RemoteReceiverDecompressor (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.RemoteReceiverDecompressor class.
 /// </summary>
 /// <param name="underlyingRemoteReceiver">The remote receiver to receive the message from before compressing.</param>
 /// <param name="decompressionBufferSize">The size of the buffer to use when decompressing the message in bytes.  Denotes how much data will be read from the internal stream decompressor class in each read operation.  Should be set to match the expected decompressed message size as closely as possible.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public RemoteReceiverDecompressor(IRemoteReceiver underlyingRemoteReceiver, int decompressionBufferSize, IMetricLogger metricLogger)
     : this(underlyingRemoteReceiver, decompressionBufferSize)
 {
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
 //------------------------------------------------------------------------------
 //
 // Method: TcpRemoteReceiver (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.TcpRemoteReceiver class.
 /// </summary>
 /// <param name="port">The port to listen for incoming connections on.</param>
 /// <param name="connectRetryCount">The number of times to retry when initially connecting, or attempting to reconnect to a TcpRemoteSender.</param>
 /// <param name="connectRetryInterval">The interval between retries to connect or reconnect in milliseconds.</param>
 /// <param name="receiveRetryInterval">The time to wait between attempts to receive a message in milliseconds.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public TcpRemoteReceiver(int port, int connectRetryCount, int connectRetryInterval, int receiveRetryInterval, IMetricLogger metricLogger)
     : this(port, connectRetryCount, connectRetryInterval, receiveRetryInterval)
 {
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
 //------------------------------------------------------------------------------
 //
 // Method: MethodInvocationRemoteSender (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.MethodInvocationRemoteSender class.
 /// </summary>
 /// <param name="serializer">Object to use to serialize method invocations.</param>
 /// <param name="sender">Object to use to send serialized method invocations.</param>
 /// <param name="receiver">Object to use to receive serialized method invocation return values.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public MethodInvocationRemoteSender(IMethodInvocationSerializer serializer, IRemoteSender sender, IRemoteReceiver receiver, IMetricLogger metricLogger)
     : this(serializer, sender, receiver)
 {
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
 //------------------------------------------------------------------------------
 //
 // Method: TcpRemoteSender (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.TcpRemoteSender class.
 /// </summary>
 /// <param name="ipAddress">The remote IP address to connect to.</param>
 /// <param name="port">The remote port to connect to.</param>
 /// <param name="connectRetryCount">The number of times to retry when initially connecting, or attempting to reconnect to a TcpRemoteReceiver.</param>
 /// <param name="connectRetryInterval">The interval between retries to connect or reconnect in milliseconds.</param>
 /// <param name="acknowledgementReceiveTimeout">The maximum time to wait for an acknowledgement of a message in milliseconds.</param>
 /// <param name="acknowledgementReceiveRetryInterval">The time between retries to check for an acknowledgement in milliseconds.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public TcpRemoteSender(string ipAddress, int port, int connectRetryCount, int connectRetryInterval, int acknowledgementReceiveTimeout, int acknowledgementReceiveRetryInterval, IMetricLogger metricLogger)
     : this(System.Net.IPAddress.Parse("0.0.0.0"), port, connectRetryCount, connectRetryInterval, acknowledgementReceiveTimeout, acknowledgementReceiveRetryInterval)
 {
     this.ipAddress   = System.Net.IPAddress.Parse(ipAddress);
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
Exemplo n.º 26
0
 //------------------------------------------------------------------------------
 //
 // Method: ActiveMqRemoteReceiver (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.ActiveMqRemoteReceiver class.
 /// </summary>
 /// <param name="connectUriName">The unform resource identifier of the ActiveMQ broker to connect to.</param>
 /// <param name="queueName">The name of the queue to connect to.</param>
 /// <param name="messageFilter">The filter to apply to the queue.  Allows multiple remote senders and receivers to use the same queue by each applying their own unique filter.</param>
 /// <param name="connectLoopTimeout">The time to wait for a message before retrying in milliseconds.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public ActiveMqRemoteReceiver(string connectUriName, string queueName, string messageFilter, int connectLoopTimeout, IMetricLogger metricLogger)
     : this(connectUriName, queueName, messageFilter, connectLoopTimeout)
 {
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
Exemplo n.º 27
0
 //------------------------------------------------------------------------------
 //
 // Method: SoapMethodInvocationSerializer (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.SoapMethodInvocationSerializer class.
 /// </summary>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public SoapMethodInvocationSerializer(IMetricLogger metricLogger)
     : this()
 {
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
Exemplo n.º 28
0
 //------------------------------------------------------------------------------
 //
 // Method: SoapMethodInvocationSerializer (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.SoapMethodInvocationSerializer class.
 /// </summary>
 /// <param name="logger">The logger to write log events to.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public SoapMethodInvocationSerializer(IApplicationLogger logger, IMetricLogger metricLogger)
     : this()
 {
     loggingUtilities = new LoggingUtilities(logger);
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
 //------------------------------------------------------------------------------
 //
 // Method: RemoteSenderCompressor (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.RemoteSenderCompressor class.
 /// </summary>
 /// <param name="underlyingRemoteSender">The remote sender to send the message to after compressing.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public RemoteSenderCompressor(IRemoteSender underlyingRemoteSender, IMetricLogger metricLogger)
     : this(underlyingRemoteSender)
 {
     metricsUtilities = new MetricsUtilities(metricLogger);
 }
Exemplo n.º 30
0
 //------------------------------------------------------------------------------
 //
 // Method: FileRemoteReceiver (constructor)
 //
 //------------------------------------------------------------------------------
 /// <summary>
 /// Initialises a new instance of the MethodInvocationRemoting.FileRemoteReceiver class.
 /// </summary>
 /// <param name="messageFilePath">The full path of the file used to receive messages.</param>
 /// <param name="lockFilePath">The full path of the file used to indicate when the message file is locked for writing.</param>
 /// <param name="readLoopTimeout">The time to wait between attempts to read the file in milliseconds.</param>
 /// <param name="metricLogger">The metric logger to write metric and instrumentation events to.</param>
 public FileRemoteReceiver(string messageFilePath, string lockFilePath, int readLoopTimeout, IMetricLogger metricLogger)
     : this(messageFilePath, lockFilePath, readLoopTimeout)
 {
     metricsUtilities = new MetricsUtilities(metricLogger);
 }