Пример #1
0
    /// <summary>
    ///     Initializes a new instance of the <see cref="TcpTransport" /> class.
    /// </summary>
    /// <exception cref="ArgumentNullException">stompConnectionSettings can not be null.</exception>
    /// <param name="location">The URI.</param>
    /// <param name="socket">The socket to use.</param>
    /// <param name="wireFormat">A <see cref="IWireFormat" />.</param>
    /// <param name="stompConnectionSettings">Some STOMP connection settings.</param>
    public SslTransport(Uri location, Socket socket, IWireFormat wireFormat, [NotNull] StompConnectionSettings stompConnectionSettings)
        : base(location, socket, wireFormat)
    {
        stompConnectionSettings.ThrowIfNull(nameof(stompConnectionSettings));

        _stompConnectionSettings = stompConnectionSettings;
    }
Пример #2
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="SslTransportFactory" /> class.
        /// </summary>
        /// <exception cref="ArgumentNullException">stompConnectionSettings can not be null.</exception>
        /// <param name="stompConnectionSettings">Some STOMP settings.</param>
        public SslTransportFactory([NotNull] StompConnectionSettings stompConnectionSettings)
            : base(stompConnectionSettings)
        {
            stompConnectionSettings.ThrowIfNull(nameof(stompConnectionSettings));

            _stompConnectionSettings = stompConnectionSettings;
        }
Пример #3
0
        public Session(Connection connection, SessionInfo info, AcknowledgementMode acknowledgementMode, [NotNull] StompConnectionSettings stompConnectionSettings)
        {
            stompConnectionSettings.ThrowIfNull(nameof(stompConnectionSettings));
            _stompConnectionSettings = stompConnectionSettings;

            Connection          = connection;
            _info               = info;
            AcknowledgementMode = acknowledgementMode;

            if (acknowledgementMode == AcknowledgementMode.Transactional)
            {
                TransactionContext = new TransactionContext(this);
            }
            else if (acknowledgementMode == AcknowledgementMode.DupsOkAcknowledge)
            {
                AcknowledgementMode = AcknowledgementMode.AutoAcknowledge;
            }

            Executor = new SessionExecutor(this, _consumers);
        }
Пример #4
0
        public Connection(Uri connectionUri, ITransport transport, IdGenerator clientIdGenerator, [NotNull] StompConnectionSettings stompConnectionSettings)
        {
            stompConnectionSettings.ThrowIfNull(nameof(stompConnectionSettings));

            _stompConnectionSettings = stompConnectionSettings;
            _transportFactory        = new TransportFactory(_stompConnectionSettings);
            BrokerUri          = connectionUri;
            _clientIdGenerator = clientIdGenerator;

            SetTransport(transport);

            _info = new ConnectionInfo
            {
                ConnectionId = new ConnectionId {
                    Value = ConnectionIdGenerator.GenerateId()
                },
                Host     = BrokerUri.Host,
                UserName = _stompConnectionSettings.UserName,
                Password = _stompConnectionSettings.Password
            };

            MessageTransformation = new StompMessageTransformation(this);
        }
Пример #5
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="ConnectionFactory" /> class.
 /// </summary>
 /// <param name="brokerUri">The broker URI.</param>
 /// <param name="stompConnectionSettings">The STOM connection settings.</param>
 public ConnectionFactory(String brokerUri, StompConnectionSettings stompConnectionSettings)
 {
     BrokerUri = new(brokerUri);
     StompConnectionSettings = stompConnectionSettings;
     _transportFactory       = new TransportFactory(StompConnectionSettings);
 }