Ejemplo n.º 1
0
 public void Setup()
 {
     subscriber   = mockSubscriber.Object;
     handler      = mockHandler.Object;
     asyncHandler = mockAsyncHandler.Object;
     container    = mockContainer.Object;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Registers a <see cref="ITopicHandler{TEvent}"/>
 /// </summary>
 /// <typeparam name="TTopic">Type of the topic message</typeparam>
 /// <param name="handler">Topic message handler</param>
 public void Register <TTopic>(ITopicHandler <TTopic> handler)
 {
     Validate <TTopic>();
     handlers.Add(
         typeof(TTopic),
         eventMessage => handler.Handle((TTopic)eventMessage));
 }
Ejemplo n.º 3
0
 public Builder WithTopicHandler <TTopic>(ITopicHandler <TTopic> handler)
 {
     TopicDispatcher.Register(handler);
     return(this);
 }
Ejemplo n.º 4
0
 public IHandlerSetup WithTopicHandler <TTopic, THandler>(ITopicHandler <TTopic> handler) where TTopic : class
 {
     topicDispatcher.Register(handler);
     return(this);
 }
Ejemplo n.º 5
0
 public MqttService(ILogger <MqttService <T> > logger, IOptions <MqttSetting> optionsAccessor, ITopicHandler <T> topicHandler)
 {
     _logger       = logger;
     _options      = optionsAccessor.Value;
     _topicHandler = topicHandler;
 }