notification pattern using axon framework

hi
Any design thought on how to implement notification pattern(http://
martinfowler.com/eaaDev/Notification.html) using axon framework

Hi Steve,

it looks like you can simply implement an EventListener that listens to events. The whole EventBus and Listeners concept is one big implementation of Notification as Martin describes it.

Cheers,

Allard

hi Allard

i was trying to find out how to display user says X about any
validation errors using callBackHanlder defined in axon framework . if
i use notification pattern ,i do not have to throw any exception and
if i do not throw exception , then i have to call few methods in R
executionResult to find whether there is an error or has some valid
result like request id .

The callback handler has two method onFailure(Throwable cause) and
onSuccess(R executionResult)

example :
Use Case 1:
i have a commandhandler that handles AddDeviceInformationCommand for
X user .when AddDeviceInformationCommand command is executed ,i have
a command interceptor that will validate the command and inform the
user about the Error.
Use Case 2:
The same command can be executed by third party application/or is one
Asynchronous and does not require immediate feedback .
solution : i can use a different like
AddBulkDeviceInformationCommand

some issue .
for use case 1: if i use eventListener, how do i listen to X user
events only.

for use case 2: i want to log all validation failure

let me you comments or any alternative design .

Hi Steve,

generally, structural validation of a command should be done before it is sent to the command bus. JSR 303 (bean validation) is quite useful for this. It allows you to specify the rules once, and validate them both at the client (i.e. component putting the commands on the bus), and on the server. On the client, you can provide specific information in the UI. Once a command is sent to the server, it is rejected with an exception. In some cases, you could decide to silently discard the command.

Event Handlers must always listen to all events of a certain type. You will need to filter events based on its contents inside the handler itself.

Cheers,

Allard