Commit Graph

89 Commits

Author SHA1 Message Date
Kai S. K. Engelbart 6bf9e1097a
Support JDK-style Javadoc tags 2021-11-24 11:30:36 +01:00
Kai S. K. Engelbart e67b64678b
Merge pull request 'Add Callback Event Handling' (#26) from f/callback-handler into develop
Reviewed-on: https://git.kske.dev/kske/event-bus/pulls/26
Reviewed-by: delvh <leon@kske.dev>
2021-11-05 08:49:07 +01:00
Kai S. K. Engelbart c614beb063
Make CallbackEventHandler final 2021-11-04 15:55:24 +01:00
Kai S. K. Engelbart d3abb0aca3
Improve parameter naming for listener registration 2021-11-04 15:54:36 +01:00
Kai S. K. Engelbart ee688929fd
Add callback event handling
The EventHandler class has been converted to an interface, with the
reflection specific part being moved to the new ReflectiveEventHandler
class. Callback event handlers implement the same interface through the
CallbackEventHandler class.

The event handlers are defined in the new handler package, which is not
exported by the eventbus.core module.
2021-11-02 19:33:18 +01:00
Kai S. K. Engelbart 897d794b86
Merge pull request 'Handler Execution Order Debugging' (#25) from f/handler-introspection into develop
Reviewed-on: https://git.kske.dev/kske/event-bus/pulls/25
Reviewed-by: delvh <leon@kske.dev>
2021-11-02 09:03:10 +01:00
Kai S. K. Engelbart 40d48cb959
Merge pull request 'Improve Documentation in Code' (#24) from f/improved-documentation into develop
Reviewed-on: https://git.kske.dev/kske/event-bus/pulls/24
Reviewed-by: DieGurke <maxi@kske.dev>
2021-11-01 21:48:51 +01:00
Kai S. K. Engelbart b760c58298
Add a handler execution order debugging method 2021-11-01 21:36:24 +01:00
Kai S. K. Engelbart 872b395374
Rephrase some Javadoc
As suggested by @delvh.
2021-11-01 20:52:14 +01:00
Kai S. K. Engelbart 82c66c45ec
Improve EventBus Javadoc, make EventBusException final 2021-11-01 09:42:12 +01:00
Kai S. K. Engelbart 866a547114
Merge pull request 'Initialize the Default Event Bus Statically' (#23) from f/static-singleton-initialization into develop
Reviewed-on: https://git.kske.dev/kske/event-bus/pulls/23
Reviewed-by: delvh <leon@kske.dev>
2021-10-16 08:33:08 +02:00
Kai S. K. Engelbart 33ebf0302b
Initialize the default event bus statically
The previous method that used double checked synchronization offers
little performance benefits over a plain static initialization.

Reported-by @harkle-the-cake
2021-10-16 08:32:28 +02:00
Kai S. K. Engelbart b915a5c490
Merge pull request 'Properly Handle Nested Dispatches' (#19) from b/nested-dispatch into develop
Reviewed-on: https://git.kske.dev/kske/event-bus/pulls/19
Reviewed-by: delvh <leon@kske.dev>
2021-07-12 11:25:04 +02:00
Kai S. K. Engelbart 205a183db7
Allow nested dispatches by keeping track of nesting count 2021-07-12 10:24:48 +02:00
Kai S. K. Engelbart 74447dea59
Add nested dispatch test
The test performs a nested event dispatch then cancels the dispatch. If
Both operations are successful, the test is successful.

Currently, the test fails, but should be successful once the nested
dispatch bug is fixed.
2021-07-12 10:17:46 +02:00
Kai S. K. Engelbart 6eebd3c121
Pass errors caused during system event dispatch to caller
When an error is caused during the dispatch of a system event, a warning
has been logged instead instead of rethrowing the error. This has been
fixed.

This enables failing a JUnit test when an exception event handler is
invoked.
2021-07-07 22:06:07 +02:00
Kai S. K. Engelbart b758f4cef1
Remove obsolete paragraph from README 2021-04-04 10:09:12 +02:00
Kai S. K. Engelbart 0dcad7d178
Bump version to 1.1.0 2021-03-28 10:37:41 +02:00
Kai S. K. Engelbart c0cda7341b
Merge pull request 'Add @delvh as Contributor' (#15) from add-delvh-as-contributor into develop
Reviewed-on: https://git.kske.dev/kske/event-bus/pulls/15
Reviewed-by: delvh <leon@kske.dev>
2021-03-17 17:25:30 +01:00
Kai S. K. Engelbart b804243f4e
Add @delvh as contributor 2021-03-17 13:10:20 +01:00
Kai S. K. Engelbart 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
Kai S. K. Engelbart 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
Kai S. K. Engelbart f74b953db8
Replace hardcoded priority value by constant 2021-03-16 10:17:24 +01:00
Kai S. K. Engelbart 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
Kai S. K. Engelbart 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
Kai S. K. Engelbart 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
Kai S. K. Engelbart 32dfe64c0f
Add listener-level properties section to README 2021-03-14 11:44:56 +01:00
Kai S. K. Engelbart 2ec0a82a96
Respect listener-level properties 2021-03-14 11:18:11 +01:00
Kai S. K. Engelbart 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
Kai S. K. Engelbart 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
Kai S. K. Engelbart 7c3cd017de
Add system events section to README 2021-02-21 13:50:12 +01:00
Kai S. K. Engelbart 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
Kai S. K. Engelbart 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
Kai S. K. Engelbart b2fe3a9d6c
Log unhandled dead events 2021-02-20 22:10:48 +01:00
Kai S. K. Engelbart 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
Kai S. K. Engelbart 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
Kai S. K. Engelbart 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
Kai S. K. Engelbart 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
Kai S. K. Engelbart 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
Kai S. K. Engelbart 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
Kai S. K. Engelbart 1dd9e05c38
Rename event-bus-ap to event-bus-proc 2021-02-15 21:02:34 +01:00
Kai S. K. Engelbart 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
Kai S. K. Engelbart 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
Kai S. K. Engelbart 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
Kai S. K. Engelbart cd2e7ad023
Rename Event#eventType to Event#value for more concise usage 2021-02-15 13:42:20 +01:00
Kai S. K. Engelbart 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
Kai S. K. Engelbart 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
Kai S. K. Engelbart e040f6ab1b
Simplify binding access calls in EventBus 2021-02-15 09:25:16 +01:00
Kai S. K. Engelbart ebc11555f6
Fix developer connection string in POM 2021-02-15 08:26:07 +01:00
Kai S. K. Engelbart 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