JdbcSagaRepository that serves our purpose of "unification" and serilaization, so the only question here is about the
Security.
Security now...
Security ...Hi,
For the security and authorization related concerns I would implement a custom CommandBusInterceptor which would collaborate with the UAA service to verify the JWT signature, and then decide if the command should be dispatched to the command handler or denied. Hope that helps.
--
You received this message because you are subscribed to the Google Groups "Axon Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to axonframewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Sagas can only be stores as byte[] after all... I had to extend PostgresSagaSqlSchema and JdbcSagaRepository.storeSaga to get rid off the SagaEntry.class that seriializes as byte[] and it's not extensible
RootTaskAggregate
@EventSourcedMember
protected ist<ChildTaskAggregate> childs = new ArrayList<ChildTaskAggregate>();
and
ChildTaskAggregate extends RootTaskAggregate implements EventSourcedEntity
@CommandHandler
public TaskAggregate(CreateTaskCommand command) throws Exception {
apply(new TaskCreatedEvent(command.getId()) );
}
@EventSourcingHandler
public void on(TaskCreatedEvent event) throws Exception {
this.id = event.getId();
Task task = new Task();
task.creationDate = DateTime.now();
task.setState(TaskState.CREATED);
}
@CommandHandler
public TaskAggregate(CreateTaskCommand command) throws Exception {
Task task = new Task();
task.creationDate = DateTime.now();
apply(new TaskCreatedEvent(task) );
}
@EventSourcingHandler
public void on(TaskCreatedEvent event) throws Exception {
this.id = event.getId();
Task task = event.getTask();
task.setState(TaskState.CREATED);
}
3) hybrid "work"
@CommandHandler
public TaskAggregate(CreateTaskCommand command) throws Exception {
apply(new TaskCreatedEvent(command.getId(), DateTime.now());
}
@EventSourcingHandler
public void on(TaskCreatedEvent event) throws Exception {
this.id = event.getId();
Task task = new Task();
task.creationDate = event.getDate()
task.setState(TaskState.CREATED);
}
task.setState(TaskState.CREATED);
tasks.put(task.getId(), task);
@CommandHandler
public TaskAggregate(CreateTaskCommand command) throws Exception {
Task task = new Task();
task.creationDate = DateTime.now();
apply(new TaskCreatedEvent(task) );
apply(new TaskStartedEvent(task) );
}
@EventSourcingHandler
public void on(TaskCreatedEvent event) throws Exception {
this.id = event.getId();
Task task = event.getTask();
task.setState(TaskState.CREATED);
}
@EventSourcingHandler
public void on(TaskStartedEvent event) throws Exception {
Task task = event.getTask();
task.setState(TaskState.STARTED);
}
...
--
...
--
Serialization:
We have to support Postgres with XML data types. That means serialize Metadata, Events and Sagas to XML (or a string representation of) and store then as XML. For that I had to implement a Axon Serializer, extend GenericEventSqlSchema, PostgresSagaSqlSchema and JdbcSagaRepository. Not a big problem here but the code could be more clean with some small changes in Axon itself, if you want to discuss that I'll be happy to do it.
public <T> SerializedObject<T> serialize(Object object, Class<T> expectedRepresentation) {
if (object instanceof MetaData || object instanceof Saga) {
// use XStream
} else {
// use JAXB
}
...