Exemple #1
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: 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: 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: 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: 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: 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);
 }
Exemple #7
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());
 }
Exemple #8
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);
 }
 //------------------------------------------------------------------------------
 //
 // 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>
 public TcpRemoteSender(string ipAddress, int port, int connectRetryCount, int connectRetryInterval, int acknowledgementReceiveTimeout, int acknowledgementReceiveRetryInterval, IApplicationLogger logger)
     : this(System.Net.IPAddress.Parse("0.0.0.0"), port, connectRetryCount, connectRetryInterval, acknowledgementReceiveTimeout, acknowledgementReceiveRetryInterval)
 {
     this.ipAddress   = System.Net.IPAddress.Parse(ipAddress);
     this.logger      = logger;
     loggingUtilities = new LoggingUtilities(logger);
 }
 //------------------------------------------------------------------------------
 //
 // 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);
 }
 //------------------------------------------------------------------------------
 //
 // 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());
 }
Exemple #13
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());
 }
Exemple #14
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);
 }
Exemple #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: 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());
 }
 //------------------------------------------------------------------------------
 //
 // 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;
        }
Exemple #20
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: 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="logger">The logger to write log events to.</param>
 public MethodInvocationRemoteSender(IMethodInvocationSerializer serializer, IRemoteSender sender, IRemoteReceiver receiver, IApplicationLogger logger)
     : this(serializer, sender, receiver)
 {
     loggingUtilities = new LoggingUtilities(logger);
 }
Exemple #23
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="logger">The logger to write log events to.</param>
 public ActiveMqRemoteReceiver(string connectUriName, string queueName, string messageFilter, int connectLoopTimeout, IApplicationLogger logger)
     : this(connectUriName, queueName, messageFilter, connectLoopTimeout)
 {
     this.logger      = logger;
     loggingUtilities = new LoggingUtilities(logger);
 }
Exemple #24
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>
 public SoapMethodInvocationSerializer(IApplicationLogger logger)
     : this()
 {
     loggingUtilities = new LoggingUtilities(logger);
 }
Exemple #25
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>
 /// <param name="logger">The logger to write log events to.</param>
 public RemoteReceiverDecompressor(IRemoteReceiver underlyingRemoteReceiver, IApplicationLogger logger)
     : this(underlyingRemoteReceiver)
 {
     this.logger      = logger;
     loggingUtilities = new LoggingUtilities(logger);
 }