public TmqClient CreateInstance()
        {
            TmqClient client = new TmqClient();

            if (!string.IsNullOrEmpty(_id))
            {
                client.ClientId = _id;
            }

            if (!string.IsNullOrEmpty(_name))
            {
                client.SetClientName(_name);
            }

            if (!string.IsNullOrEmpty(_type))
            {
                client.SetClientType(_type);
            }

            if (!string.IsNullOrEmpty(_token))
            {
                client.SetClientToken(_token);
            }

            if (_enhance != null)
            {
                _enhance(client);
            }

            return(client);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Client creation action for server instances
        /// </summary>
        private static TmqClient CreateInstanceClient(InstanceOptions options)
        {
            TmqClient client = new TmqClient();

            client.SetClientName(options.Name);
            client.SetClientToken(options.Token);
            client.SetClientType("server");
            return(client);
        }
Ejemplo n.º 3
0
 public Producer()
 {
     _connector = new TmqAbsoluteConnector(TimeSpan.FromSeconds(5), () =>
     {
         TmqClient client = new TmqClient();
         client.ClientId  = "producer-id";
         client.SetClientType("producer");
         client.SetClientToken("S3cr37_pr0duc3r_t0k3n");
         return(client);
     });
 }
Ejemplo n.º 4
0
        public Consumer()
        {
            _connector = new TmqStickyConnector(TimeSpan.FromSeconds(5), () =>
            {
                TmqClient client = new TmqClient();
                client.ClientId  = "consumer-id";
                client.SetClientType("consumer");
                client.SetClientToken("anonymous");
                client.AutoAcknowledge = true;

                return(client);
            });
        }