Disruptor command bus with snapshotter

Hello there,

I was wondering if I can specify a snaphotter for repositories specified for disruptor command bus?

The sample configuration for disruptor command bus is as below

 <axon:disruptor-command-bus id="commandBus" event-store="eventStore" event-bus="eventBus" command-target-resolver="commandTargetResolver">
            <axon:repository id="exampleRepository" aggregate-type="org.axonframework.contextsupport.spring.DisruptorContextConfigurationTest.MyAggregate"/>

I would like to specify snaphotter for my repository as I can for a simple command bus

<axon:command-bus id="commandBus" transaction-manager="transactionManager">
      <ref bean="myInterceptor"/>

  <axon:event-bus id="eventBus"/>

  <axon:snapshotter event-store="eventStore" id="axonSnapshotter" transaction-manager="transactionManager"/>

  <!-- Definition of repositories -->
  <axon:event-sourcing-repository id="exampleRepository" aggregate-type="org.axonframework.contextsupport.spring.DisruptorContextConfigurationTest.MyAggregate">
**    <axon:snapshotter-trigger event-count-threshold="50" snapshotter-ref="axonSnapshotter"/>**

I'm asking because I do not find documentation for it in the XSD of axon attached. 

Best regards
Viswanath Jayachandran

axon-core-2.1.xsd (89.1 KB)

Hi Viswanath,

I guess you found a missing feature here. Looking at the implementation of the DisruptorCommandBus (and its repository), it simply looks like there currently isn’t a possibility to register a snapshotter.
A workaround would be to periodically query the event store (directly, not through the EventStore API) for the max sequence number and compare that to the latest snapshot. Another option would be to wrap the Event Store and decorate the streams going in and out of it “manually”.

This is definitely something that should (have been) in there. I will create an issue for it in the issue tracker, so it will be available in future versions.



Thanks for your prompt reply Allard!

I shall look forward to that feature in one of the upcoming releases.

Onegini logo small signature[18].png

Hi, Allard

Hate to push you here, but do you have any plan to add Snapshotter support to DisruptorCommandBus? In Axon 2.4.2, I didn’t find a way to register a snapshotter into both DisruptorCommandBus & DisruptorRepository…


Hi Nick,

you need to create a repository using this method: http://www.axonframework.org/apidocs/2.4/org/axonframework/commandhandling/disruptor/DisruptorCommandBus.html#createRepository(org.axonframework.eventsourcing.AggregateFactory,%20org.axonframework.eventsourcing.EventStreamDecorator)

The snapshotter triggers implement the EventStreamDecorator interface.



Hi, Allard

Great, will try it, thanks. :grinning: