Line data Source code
1 : #region Copyright
2 : // // -----------------------------------------------------------------------
3 : // // <copyright company="Chinchilla Software Limited">
4 : // // Copyright Chinchilla Software Limited. All rights reserved.
5 : // // </copyright>
6 : // // -----------------------------------------------------------------------
7 : #endregion
8 :
9 : using System;
10 : using cdmdotnet.Logging;
11 : using Cqrs.Authentication;
12 : using Cqrs.Events;
13 : using Cqrs.WebApi.SignalR.Hubs;
14 :
15 : namespace Cqrs.WebApi.Events.Handlers
16 : {
17 : /// <summary>
18 : /// Proxies ALL <see cref="IEvent{TAuthenticationToken}">events</see> received from the event bus to the <see cref="INotificationHub"/>.
19 : /// This gets registered as a global <see cref="IEventHandler"/>.
20 : /// </summary>
21 : /// <typeparam name="TAuthenticationToken">The <see cref="Type"/> of the authentication token.</typeparam>
22 : public class GlobalEventToHubProxy<TAuthenticationToken>
23 : : EventToHubProxy<TAuthenticationToken>
24 : , IEventHandler<TAuthenticationToken, IEvent<TAuthenticationToken>>
25 1 : {
26 : /// <summary>
27 : /// Instantiates a new instance of <see cref="GlobalEventToHubProxy{TAuthenticationToken}"/>.
28 : /// </summary>
29 1 : public GlobalEventToHubProxy(ILogger logger, INotificationHub notificationHub, IAuthenticationTokenHelper<TAuthenticationToken> authenticationTokenHelper)
30 : : base(logger, notificationHub, authenticationTokenHelper)
31 : {
32 : }
33 :
34 : #region Implementation of IMessageHandler<in IEvent<TAuthenticationToken>>
35 :
36 : /// <summary>
37 : /// Calls <see cref="EventToHubProxy{TAuthenticationToken}.HandleGenericEvent"/>.
38 : /// </summary>
39 : /// <param name="event">The <see cref="IEvent{TAuthenticationToken}"/> to proxy.</param>
40 1 : public void Handle(IEvent<TAuthenticationToken> @event)
41 : {
42 : HandleGenericEvent(@event);
43 : }
44 :
45 : #endregion
46 : }
47 : }
|