public BusProducer(IBusConnection connection, IQueueConfiguration config, ILogger logger = null) { _connection = connection; _logger = logger; _config = config; TryCreateChannel(); }
public BusManager(IBusConnection connection, IBusConfiguration config, ILogger <BusManager> logger = null) { _config = config; _connection = connection; _logger = logger; InitQueues(); }
public RabbitPublisher(IBusConnection connection) { _connection = connection ?? throw new ArgumentNullException(nameof(connection)); _channel = _connection.CreateChannel(); _channel.ExchangeDeclare(exchange: ExchangeName, type: ExchangeType.Fanout); _properties = _channel.CreateBasicProperties(); }
public RabbitSubscriber(IBusConnection connection, RabbitSubscriberOptions options, IDecoder decoder, ILogger <RabbitSubscriber> logger) { _connection = connection ?? throw new ArgumentNullException(nameof(connection)); _options = options ?? throw new ArgumentNullException(nameof(options)); _decoder = decoder ?? throw new ArgumentNullException(nameof(decoder)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public HttpEventManager(IRequestResponseRepository requestResponseRepository, IBusConnection connection) { _requestResponseRepository = requestResponseRepository; _connection = connection; PopulatePublishers(); }
public BusQueue(IBusConnection connection, IServiceConfiguration config, ILogger logger = null) { _connection = connection; _config = config; _logger = logger; TryInit(); }
public static IBusConnection Initialize(Action <IBusConfiguration> configAction) { var config = new BusConfiguration(); configAction(config); config.Build(); return(Instance = new EasyConnection(config)); }
public void TearDown() { if (Connection != null) { Connection.Dispose(); } Connection = null; }
public RabbitSubscriber(IBusConnection connection, IHubContext <ChatHub> hubContext, IMessagesRepository messagesRepository) { _connection = connection ?? throw new ArgumentNullException(nameof(connection)); this._hubContext = hubContext; this._messagesRepository = messagesRepository; //_jsonSettings = new JsonSerializerSettings //{ // Converters = new List<JsonConverter> { new StringEnumConverter(), new ExtensibleEnumBaseConverter() }, // ContractResolver = new CamelCasePropertyNamesContractResolver() //}; }
protected virtual void Dispose(bool fDisposing) { System.Diagnostics.Debug.WriteLineIf(!fDisposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** "); if (fDisposing) { if (Connection != null) { Connection.Dispose(); } } Connection = null; }
public RabbitPublisher(IBusConnection connection, string exchangeName) { if (string.IsNullOrWhiteSpace(exchangeName)) { throw new ArgumentException($"'{nameof(exchangeName)}' cannot be null or whitespace", nameof(exchangeName)); } _exchangeName = exchangeName; _connection = connection ?? throw new ArgumentNullException(nameof(connection)); _channel = _connection.CreateChannel(); _channel.ExchangeDeclare(exchange: _exchangeName, type: ExchangeType.Fanout); _properties = _channel.CreateBasicProperties(); }
/// <summary/> public DummyInputBusController() { m_connection = IBusConnectionFactory.Create(); if (m_connection == null) { return; } m_ibus = new IBusDotNet.InputBusWrapper(m_connection); m_inputContext = m_ibus.InputBus.CreateInputContext("UnitTest"); m_inputContext.SetCapabilities(Capabilities.Focus | Capabilities.PreeditText); }
internal Consumer(BusConnection connection, IBusLogger logger, IRetryBehavior retryBehavior, IServiceScopeFactory scopeFactory, ConsumerOptions <T> options) { _options = options ?? throw new ArgumentNullException(nameof(options)); _connection = connection ?? throw new ArgumentNullException(nameof(connection)); _logger = logger; _retryBehavior = retryBehavior ?? throw new ArgumentNullException(nameof(retryBehavior)); _scopeFactory = scopeFactory ?? throw new ArgumentNullException(nameof(scopeFactory)); _tasks = new Tasks(_options.ConsumerMaxParallelTasks); _channel = connection.ConsumerConnection.CreateModel(); _channel.BasicQos(0, options.PrefetchCount, false); DeclareAndBind(); _consumerTag = _channel.BasicConsume(_options.Queue.Name.Value, false, this); }
public HttpEventPublisher(IBusConnection connection, RequestResponse requestResponse) { _connection = connection ?? throw new ArgumentNullException(nameof(connection)); _channel = _connection.CreateChannel(); _channel.ExchangeDeclare(exchange: ExchangeName, type: ExchangeType.Fanout); _properties = _channel.CreateBasicProperties(); _requestResponse = requestResponse; _timer = new Timer(requestResponse.Interval); _timer.Elapsed += RaiseHttpEvent; _timer.AutoReset = true; _timer.Enabled = true; }
/// <summary/> protected virtual void Dispose(bool fDisposing) { System.Diagnostics.Debug.WriteLineIf(!fDisposing, "****** Missing Dispose() call for " + GetType() + ". *******"); if (fDisposing && !IsDisposed) { // dispose managed and unmanaged objects if (m_connection != null) { m_connection.Dispose(); } } m_connection = null; IsDisposed = true; }
public RabbitSubscriber(IBusConnection connection, IQueueReferenceFactory queueReferenceFactory, IMessageParser messageParser, IMessageProcessor messageProcessor, ILogger <RabbitSubscriber <TM> > logger) { if (queueReferenceFactory == null) { throw new ArgumentNullException(nameof(queueReferenceFactory)); } _connection = connection ?? throw new ArgumentNullException(nameof(connection)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _messageProcessor = messageProcessor ?? throw new ArgumentNullException(nameof(messageProcessor)); _messageParser = messageParser ?? throw new ArgumentNullException(nameof(messageParser)); _queueReferences = queueReferenceFactory.Create <TM>(); }
public RabbitPublisher(IBusConnection connection, string exchangeName, IEncoder encoder, ILogger <RabbitPublisher> logger) { if (string.IsNullOrWhiteSpace(exchangeName)) { throw new ArgumentException($"'{nameof(exchangeName)}' cannot be null or whitespace", nameof(exchangeName)); } _connection = connection ?? throw new ArgumentNullException(nameof(connection)); _encoder = encoder ?? throw new ArgumentNullException(nameof(encoder)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _exchangeName = exchangeName; _channel = _connection.CreateChannel(); _channel.ExchangeDeclare(exchange: exchangeName, type: ExchangeType.Fanout); _properties = _channel.CreateBasicProperties(); _properties.Persistent = true; }
/// <summary> /// Create a Connection to Ibus. If successfull Connected property is true. /// </summary> public IbusCommunicator() { m_connection = IBusConnectionFactory.Create(); if (m_connection == null) return; // Prevent hanging on exit issues caused by missing dispose calls, or strange interaction // between ComObjects and managed object. Application.ThreadExit += (sender, args) => { if (m_connection != null) m_connection.Dispose(); m_connection = null; }; m_ibus = new InputBus(m_connection); }
public void CanGetEngineDesc() { Connection = IBusConnectionFactory.Create(); if (Connection == null) { Assert.Ignore("Can't run this test without ibus running."); return; } var ibusWrapper = new IBusDotNet.InputBusWrapper(Connection); object[] engines = ibusWrapper.InputBus.ListActiveEngines(); if (engines.Length == 0) { Assert.Ignore("Can't run this test without any ibus keyboards installed."); return; } Assert.IsNotNull(IBusEngineDesc.GetEngineDesc(engines[0])); }
/// <summary> /// Create a Connection to Ibus. If successfull Connected property is true. /// </summary> public IBusCommunicator() { m_connection = IBusConnectionFactory.Create(); if (m_connection == null) { return; } // Prevent hanging on exit issues caused by missing dispose calls, or strange interaction // between ComObjects and managed object. Application.ThreadExit += (sender, args) => { if (m_connection != null) { m_connection.Dispose(); } }; m_ibus = new IBusDotNet.InputBusWrapper(m_connection); }
public Task ConnectToBus() { var busDevice = this.SelectedBusDevice; if (busDevice == null) { return(Task.CompletedTask); } return(busDevice.Connect() .ContinueWith(t => { IBusConnection connection = null; if (!t.IsFaulted && !t.IsCanceled) { connection = t.Result; } this.Connection = connection; })); }
public static IDisposable ReceiveCommand <T>(this IBusConnection connection, string commandName, Func <T, Task> handler) { return(connection.ReceiveCommand(commandName, x => x.On(handler))); }
public static IDisposable ReceiveRpcRequest <T>(this IBusConnection connection, IRpcHandler <T> handler) { return(connection.ReceiveRpcRequest <T>(handler.HandleAsync)); }
public static IDisposable ReceiveRpcRequest <T>(this IBusConnection connection, string requestName, Func <T, Action <object>, Task> handler) { return(connection.ReceiveRpcRequest(requestName, x => x.On(handler))); }
public BaseBus(IBusConnection busConnection) { _busConnection = busConnection; }
/// <summary/> protected virtual void Dispose(bool fDisposing) { System.Diagnostics.Debug.WriteLineIf(!fDisposing, "****** Missing Dispose() call for " + GetType() + ". *******"); if (fDisposing && !IsDisposed) { // dispose managed and unmanaged objects if (m_connection != null) m_connection.Dispose(); } m_connection = null; IsDisposed = true; }
public static IDisposable ReceiveCommand <T>(this IBusConnection connection, Func <T, Task> handler) { return(connection.ReceiveCommand(GetMessageName(typeof(T)), x => x.On(handler))); }
public static IDisposable ReceiveRpcRequest <T>(this IBusConnection connection, Func <T, Action <object>, Task> handler) { return(connection.ReceiveRpcRequest(GetMessageName(typeof(T)), x => x.On(handler))); }
public static IDisposable ReceiveEvent <T>(this IBusConnection connection, IEventHandler <T> handler) { return(connection.ReceiveEvent <T>(handler.HandleAsync)); }
public static IDisposable ReceiveCommand <T>(this IBusConnection connection, ICommandHandler <T> handler) { return(connection.ReceiveCommand <T>(handler.HandleAsync)); }
public BusReceiver(IBusConnection busConnection) : base(busConnection) { }
public RabbitSubscriber(IBusConnection connection) { _connection = connection ?? throw new ArgumentNullException(nameof(connection)); }