Skip to content

LykkeCity/Lykke.Cqrs.MessageCancellation

Repository files navigation

Lykke

Lykke.Cqrs.MessageCancellation

Lykke.Cqrs.MessageCancellation is a plugin for Lykke services that use Lykke.Cqrs libriary. It consists of:

  • Asp.Net Core Controller
  • Command/Events Interceptors For Lykke.Cqrs
  • Internal Services

How to use

  • Install nuget Lykke.Cqrs.MessageCancellation
  • The endpoint for controller is "/api/plugin/message-cancellation". Ensure that this route is not yet registered in your application.
  • Register Cqrs Message Cancellation
    var builder = new ContainerBuilder();
    builder.RegisterCqrsMessageCancellation((options) =>
    {
        options.Value
            .MapMessageId<MessageWithSomeId>(x => x.MessageId)
            .MapMessageId<MessageWithGuidId>(x => x.OperationId.ToString());
    }); 
  • Add Command/Event interceptors in cqrs pipeline
    protected virtual IRegistration[] GetInterceptors()
    {
        return new IRegistration[]
        {
            Register.CommandInterceptor<MessageCancellationCommandInterceptor>(),
            Register.EventInterceptor<MessageCancellationEventInterceptor>()
        };
    }
    var interceptors = GetInterceptors();
    if (interceptors != null)
    {
        registration.AddRange(interceptors);
    }

    var cqrsEngine = new CqrsEngine(
        logFactory,
        new AutofacDependencyResolver(ctx.Resolve<IComponentContext>()),
        messagingEngine,
        new DefaultEndpointProvider(),
        true,
        registration.ToArray());

About

Plugin for Message Cancellation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages