/// <summary> /// Init instance options and starts the connections /// </summary> private void InitInstances() { if (Options.Instances == null || Options.Instances.Length < 1) { return; } _connectors = new TmqStickyConnector[Options.Instances.Length]; for (int i = 0; i < _connectors.Length; i++) { InstanceOptions options = Options.Instances[i]; TimeSpan reconnect = TimeSpan.FromMilliseconds(options.ReconnectWait); TmqStickyConnector connector = options.KeepMessages ? new TmqAbsoluteConnector(reconnect, () => CreateInstanceClient(options)) : new TmqStickyConnector(reconnect, () => CreateInstanceClient(options)); _connectors[i] = connector; connector.Tag = options; connector.AddHost(options.Host); connector.Run(); } }
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); }); }
/// <summary> /// Inits node options and starts the connections /// </summary> public void Initialize() { if (Server.Options.Nodes == null || Server.Options.Nodes.Length < 1) { return; } Connectors = new TmqStickyConnector[Server.Options.Nodes.Length]; for (int i = 0; i < Connectors.Length; i++) { NodeOptions options = Server.Options.Nodes[i]; TimeSpan reconnect = TimeSpan.FromMilliseconds(options.ReconnectWait); TmqStickyConnector connector = options.KeepMessages ? new TmqAbsoluteConnector(reconnect, () => CreateInstanceClient(options)) : new TmqStickyConnector(reconnect, () => CreateInstanceClient(options)); Connectors[i] = connector; connector.Tag = options; connector.AddHost(options.Host); } }
internal TwinoRouteBus(TmqStickyConnector connector) : base(connector) { }
internal TwinoQueueBus(TmqStickyConnector connector) : base(connector) { }
internal TwinoDirectBus(TmqStickyConnector connector) : base(connector) { }
internal TwinoBus(TmqStickyConnector connector) : base(connector) { Direct = new TwinoDirectBus <TIdentifier>(connector); Queue = new TwinoQueueBus <TIdentifier>(connector); Route = new TwinoRouteBus <TIdentifier>(connector); }