-
Notifications
You must be signed in to change notification settings - Fork 789
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create event store tracking EventProcessor
Events can now be supplied to an EventProcessor in two ways: either by subscribing the processor directly to the event bus or by streaming events from the event store and supplying those events to the event processor. The event processor then passes the events on to an EventProcessingStrategy which may decide to handle the events directly or asynchronously. Finally, when the events are handled they are passed to registered EventListeners.
- Loading branch information
1 parent
654a289
commit e762b92
Showing
65 changed files
with
1,559 additions
and
2,033 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
core/src/main/java/org/axonframework/eventhandling/DirectEventProcessingStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,29 @@ | |||
/* | |||
* Copyright (c) 2010-2016. Axon Framework | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
* You may obtain a copy of the License at | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
* See the License for the specific language governing permissions and | |||
* limitations under the License. | |||
*/ | |||
|
|||
package org.axonframework.eventhandling; | |||
|
|||
import java.util.List; | |||
import java.util.function.Consumer; | |||
|
|||
/** | |||
* @author Rene de Waele | |||
*/ | |||
public enum DirectEventProcessingStrategy implements EventProcessingStrategy { | |||
INSTANCE; | |||
|
|||
@Override | |||
public void handle(List<? extends EventMessage<?>> events, Consumer<List<? extends EventMessage<?>>> processor) { | |||
processor.accept(events); | |||
} | |||
} |
40 changes: 40 additions & 0 deletions
40
core/src/main/java/org/axonframework/eventhandling/ErrorHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,40 @@ | |||
/* | |||
* Copyright (c) 2010-2016. Axon Framework | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
* You may obtain a copy of the License at | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
* See the License for the specific language governing permissions and | |||
* limitations under the License. | |||
*/ | |||
|
|||
package org.axonframework.eventhandling; | |||
|
|||
/** | |||
* @author Rene de Waele | |||
*/ | |||
public interface ErrorHandler { | |||
|
|||
/** | |||
* Invoked after given <code>eventListener</code> failed to handle given <code>event</code>. Implementations have a | |||
* choice of options for how to continue: | |||
* <p> | |||
* <ul> <li>To ignore this error no special action is required. Processing will continue for this and subsequent | |||
* events.</li> <li>To retry processing the event, implementations can re-invoke {@link | |||
* EventListener#handle(EventMessage)} on the eventListener once or multiple times.</li> <li>To retry processing at | |||
* a later time schedule a task to re-invoke the eventListener.</li> <li>To terminate event processing altogether | |||
* implementations may throw an exception. Given default configuration this will roll back the Unit of Work involved | |||
* in the processing of this event and events that are processed in the same batch.</li></ul> | |||
* | |||
* @param exception | |||
* @param event | |||
* @param eventListener | |||
* @param eventProcessor | |||
* @throws Exception | |||
*/ | |||
void onError(Exception exception, EventMessage<?> event, EventListener eventListener, String eventProcessor) throws Exception; | |||
|
|||
} |
35 changes: 35 additions & 0 deletions
35
core/src/main/java/org/axonframework/eventhandling/EventProcessingException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,35 @@ | |||
/* | |||
* Copyright (c) 2010-2016. Axon Framework | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
* You may obtain a copy of the License at | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
* See the License for the specific language governing permissions and | |||
* limitations under the License. | |||
*/ | |||
|
|||
package org.axonframework.eventhandling; | |||
|
|||
import org.axonframework.common.AxonException; | |||
|
|||
/** | |||
* Exception thrown when an {@link EventProcessor} failed to handle a batch of events. | |||
* | |||
* @author Allard Buijze | |||
* @since 0.3 | |||
*/ | |||
public class EventProcessingException extends AxonException { | |||
|
|||
/** | |||
* Initialize the exception with given <code>message</code> and <code>cause</code>. | |||
* | |||
* @param message Message describing the cause of the exception | |||
* @param cause The exception that caused this exception to occur. | |||
*/ | |||
public EventProcessingException(String message, Throwable cause) { | |||
super(message, cause); | |||
} | |||
} |
26 changes: 26 additions & 0 deletions
26
core/src/main/java/org/axonframework/eventhandling/EventProcessingStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,26 @@ | |||
/* | |||
* Copyright (c) 2010-2016. Axon Framework | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
* You may obtain a copy of the License at | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
* See the License for the specific language governing permissions and | |||
* limitations under the License. | |||
*/ | |||
|
|||
package org.axonframework.eventhandling; | |||
|
|||
import java.util.List; | |||
import java.util.function.Consumer; | |||
|
|||
/** | |||
* @author Rene de Waele | |||
*/ | |||
public interface EventProcessingStrategy { | |||
|
|||
void handle(List<? extends EventMessage<?>> events, Consumer<List<? extends EventMessage<?>>> processor); | |||
|
|||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.