Commit Graph

119 Commits

Author SHA1 Message Date
0aef1c299b
Change license to Apache-2.0
This should allow for more compatibility with other Java applications,
including proprietary ones.
2021-03-17 12:57:43 +01:00
51f10c4144
Merge pull request 'Listener-Level Properties' (#13) from f/listener-level-properties into develop
Reviewed-on: https://git.kske.dev/kske/event-bus/pulls/13
Reviewed-by: delvh <leon@kske.dev>
2021-03-17 07:56:22 +01:00
f74b953db8
Replace hardcoded priority value by constant 2021-03-16 10:17:24 +01:00
52719d22d4
Merge pull request 'Transparently Propagate Event Handler Errors' (#14) from b/error-passthrough into develop
Reviewed-on: https://git.kske.dev/kske/event-bus/pulls/14
Reviewed-by: delvh <leon@kske.dev>
Reviewed-by: DieGurke <maxi@kske.dev>
2021-03-16 08:17:41 +01:00
122106bf39
Transparently propagate event handler errors
When an exception occurs during the execution of an event handler, it is
caught, wrapped inside an exception event and dispatched on the event
bus.

This applies to any throwable, but is not very useful for errors, as
these are not normally caught. Assertion errors in particular, which are
used in unit tests, should not be caught, as this would cause the test
runner to miss a failed test.

Therefore, errors are now transparently passed through to the caller of
the dispatch method.
2021-03-15 08:29:15 +01:00
7357198d45
Warn about useless handler property redefinitions
When polymorphism or a priority is defined at listener-level and then
identically defined for a specific handler, a warning is issued.

This does not affect redefinitions of default values.
2021-03-14 14:38:43 +01:00
32dfe64c0f
Add listener-level properties section to README 2021-03-14 11:44:56 +01:00
2ec0a82a96
Respect listener-level properties 2021-03-14 11:18:11 +01:00
6c74af608c
Allow @Polymorphic and @Priority on types, add value to @Polymorphic
This is the first step for listener level handler properties.

To allow a handler inside a polymorphic listener to be non-polymorphic,
the @Polymorphic annotation now has a boolean value that defaults to
true. In that case, it can be explicitly set to false to override the
listener-level default.
2021-02-22 19:12:06 +01:00
d9ddc0e1a9
Merge pull request 'Add ExceptionEvent' (#12) from f/exception-event into develop
Reviewed-on: https://git.kske.dev/kske/event-bus/pulls/12
Reviewed-by: delvh <leon@kske.dev>
Reviewed-by: DieGurke <maxi@kske.dev>
2021-02-21 14:04:26 +01:00
7c3cd017de
Add system events section to README 2021-02-21 13:50:12 +01:00
6a2cad4ae5
Add ExceptionEvent
An exception event wraps an event that caused an exception inside of an
event handler while being dispatched and is then dispatched to dedicated
handlers.
2021-02-21 10:36:06 +01:00
0f9b64be48
Merge pull request 'Add DeadEvent' (#9) from f/dead-event into develop
Reviewed-on: https://git.kske.dev/kske/event-bus/pulls/9
Reviewed-by: delvh <leon@kske.dev>
Reviewed-by: DieGurke <maxi@kske.dev>
2021-02-21 09:16:32 +01:00
b2fe3a9d6c
Log unhandled dead events 2021-02-20 22:10:48 +01:00
9379e6bb94
Merge pull request 'Additional Warnings in Event Bus Proc' (#8) from f/additional-warnings into develop
Reviewed-on: https://git.kske.dev/kske/event-bus/pulls/8
Reviewed-by: delvh <leon@kske.dev>
2021-02-20 21:46:08 +01:00
0036dc4829
Add DeadEvent
A dead events wraps an event that was dispatched but not delivered to
any handler. The dead event is than dispatched to dedicated handlers.
2021-02-19 16:05:11 +01:00
8a30493c52
Warn about unused event handler return values
If an event handler has a non-void return type, a warning is issued as
the event bus cannot use the returned value.

In rare cases this might be justified as the event handler could be
invoked directly.
2021-02-19 11:34:58 +01:00
b56f08e441
Warn about unnecessarily polymorphic event handlers
When Event Bus Proc detects a handler for a final type that uses the
@Polymorphic annotation, it issues a warning.
2021-02-19 11:30:09 +01:00
4a5b94a9b7
Allow event handlers with non-void return type
Also removed unnecessary files from the Event Bus Proc JAR and
configured GPG signing as well as deployment to Sonatype OSSRH.
2021-02-19 11:14:43 +01:00
ff35e7f37d
Fix several edge cases in EventProcessor
When encountering an event handler with an invalid signature, the
processor doesn't crash anymore. Also, event parameters that aren't
objects are now reported as errors.
2021-02-17 08:22:48 +01:00
1dd9e05c38
Rename event-bus-ap to event-bus-proc 2021-02-15 21:02:34 +01:00
39c51c8953
Merge pull request 'Split @Event Parameters Into @Polymorphic and @Property, Remove Marker Interfaces' (#5) from f/new-annotations into develop
Reviewed-on: https://git.kske.dev/kske/event-bus/pulls/5
Reviewed-by: delvh <leon@kske.dev>
2021-02-15 20:38:18 +01:00
002180ed3b
Remove EventListener and IEvent marker interfaces
This allows Event Bus to interface with existing classes without
modification.
2021-02-15 20:36:09 +01:00
603fe80df6
Merge pull request 'Restructure Project, Add Annotation Processor' (#4) from f/annotation-processor into develop
Reviewed-on: https://git.kske.dev/kske/event-bus/pulls/4
Reviewed-by: delvh <leon@kske.dev>
2021-02-15 13:42:27 +01:00
cd2e7ad023
Rename Event#eventType to Event#value for more concise usage 2021-02-15 13:42:20 +01:00
9b1c708514
Replace priority with @Priority
The new @Priority annotation serves the exact same purpose as
@Event(priority = ...), but should be easier to read in complex handler
declarations. It has to be used in conjunction with the @Event
annotation, not instead of it.
2021-02-15 12:06:33 +01:00
3a6ebe9a19
Replace includeSubtypes with @Polymorphic
The new @Polymorphic annotation serves the exact same purpose as
@Event(includeSubtypes = true), but should be easier to read in complex
handler declarations. It has to be used in conjunction with the @Event
annotation, not instead of it.
2021-02-15 10:55:30 +01:00
e040f6ab1b
Simplify binding access calls in EventBus 2021-02-15 09:25:16 +01:00
ebc11555f6
Fix developer connection string in POM 2021-02-15 08:26:07 +01:00
955e2d82b4
Add Event Bus AP section to README
Additionally bump version to 1.0.0 and adjust package names.
2021-02-14 21:48:24 +01:00
ab01845178
Refactor EventProcessor for improved readability 2021-02-14 21:29:06 +01:00
023acb9172
Add simple annotation processor, generate shaded processor JAR 2021-02-14 14:34:19 +01:00
fd255d65cc
Rename event-bus module to event-bus-core, add event-bus-ap module
event-bus is now a parent project containing the two modules
event-bus-core (the previous event-bus) and event-bus-ap (annotation
processor).

The version of the parent project (and thus that of the modules) has
been bumped to 1.0.0, as this change breaks compatibility with previous
versions due to the different artifact, module and package names.
2021-02-09 09:52:26 +01:00
9701e862df
Add parent project, convert existing project to Maven module 2021-02-08 19:30:37 +01:00
dcc578076a
Move project to subdirectory, adjust .gitignore 2021-02-08 18:49:37 +01:00
883efed342
Update license in POM 2021-02-06 14:05:48 +01:00
273531e352
Link the Maven repository in README 2021-01-08 09:45:07 +01:00
8b1e3a8c4a
Rewrite a paragraph in README 2021-01-03 17:00:20 +01:00
d098b83d85
Change license to GPL-3.0 2021-01-03 15:29:36 +01:00
cc266ca408
Add CODE_OF_CONDUCT 2020-12-14 11:57:55 +01:00
748cb8b71a
Merge pull request 'Add Event Cancellation' (#3) from f/cancel-event into develop
Reviewed-on: https://git.kske.dev/zdm/event-bus/pulls/3
2020-11-26 08:57:46 +01:00
0e5f31b63e
Merge branch 'develop' into f/cancel-event
Conflicts:
	src/test/java/dev/kske/eventbus/EventBusTest.java
2020-11-26 08:16:01 +01:00
ec73be9046
Split EventBusTest into DispatchTest and CancelTest, add Javadoc 2020-11-26 08:14:11 +01:00
659bd7888f
Simplify cancellation test, fix a typo 2020-11-25 08:35:51 +01:00
8aefb43823
Add Test for Cancellation 2020-11-23 23:42:17 +01:00
9d1707de5b
Add event consumption section to README 2020-10-11 11:31:51 +02:00
1d2102d729
Add event cancellation mechanism to EventBus 2020-10-02 17:50:11 +02:00
cd2598d5d3 Add Section About Static Methods in README (#2)
Add paragraph about static methods in README

Co-authored-by: kske <kai@kske.dev>
Reviewed-on: https://git.kske.dev/zdm/event-bus/pulls/2
Reviewed-by: kske <kai@kske.dev>
2020-09-26 09:59:08 +02:00
f6e5c90a44
Add static event handler test 2020-09-25 16:22:27 +02:00
dbb816c6cb
Add double checked synchronization to EventBus instance initializer 2020-09-24 17:41:08 +02:00