public MessageContext(MessageMetaData meta, IEndpoint endpoint, MessagingService messagingService, MessageTypeProperties props = null) { MetaData = meta; Endpoint = endpoint; MessagingService = messagingService; Props = props; }
public static IServiceRegistrar AddMessaging(this IServiceCollection services, Profile profile, EndpointBindings bindings, Action <MessagingConfiguration> config, params Assembly[] messageAndHandlerAssemblies) { MessagingService.InitializeTypes(messageAndHandlerAssemblies); if (bindings != null) { profile.AddBindings(bindings); } var messagingConfig = new MessagingConfiguration(); if (config != null) { config.Invoke(messagingConfig); } services.AddSingleton(messagingConfig); services.AddTransient <IServiceFactory>(x => new MicrosoftDependencyInjectionServiceFactory(x)); services.AddSingleton(profile); services.AddSingleton <MessagingService>(); services.AddTransient <IMessagingClient, MessagingClient>(); //setup user message handlers services.Scan(c => { c.FromAssemblies(messageAndHandlerAssemblies) .AddClasses(t => t.AssignableTo(typeof(IMessageHandler <>))) .AsImplementedInterfaces() .WithTransientLifetime() .AddClasses(t => t.AssignableTo(typeof(ICustomMessageHandler <>))) .AsImplementedInterfaces() .WithTransientLifetime() .AddClasses(t => t.AssignableTo(typeof(ISaga <,>))) .AsImplementedInterfaces() .AsSelf() .WithTransientLifetime() .AddClasses(t => t.AssignableTo(typeof(ISagaPersistence <,>))) .AsImplementedInterfaces() .WithTransientLifetime() ; }); return(new ServiceRegistrar(services)); }
public MessagingClient(MessagingService messagingService, IOutboxSession outbox) { _messagingService = messagingService; _outbox = outbox; }
public Task Reply(IIntegrationReply reply, MessageMetaData replyMetaData = null) { var replyToEndpoint = this.GetEndpointForReply(); return(MessagingService.Reply(reply, replyToEndpoint, this.OutboxSession, replyMetaData, this.MetaData)); }