Skip to content

Commit

Permalink
Refactorings, Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
bennidi committed Jun 23, 2015
1 parent 005915b commit 5bc924c
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 59 deletions.
50 changes: 28 additions & 22 deletions README.md
Expand Up @@ -16,6 +16,7 @@ Table of contents:
+ [Wiki](#wiki)
+ [Release Notes](#release-notes)
+ [Roadmap](#roadmap)
+ [Integrations](#integrations)
+ [Credits](#credits)
+ [Contribute](#contribute)
+ [License](#license)
Expand Down Expand Up @@ -137,8 +138,8 @@ Message handlers are defined via annotations added to instance methods. The simp
.addFeature(Feature.SyncPubSub.Default())
.addFeature(Feature.AsynchronousHandlerInvocation.Default())
.addFeature(Feature.AsynchronousMessageDispatch.Default())
.setProperty(Properties.Common.Id, "global bus")
.setProperty(Properties.Handler.PublicationError, new IPublicationErrorHandler{...}));
.addPublicationErrorHandler(new IPublicationErrorHandler{...})
.setProperty(Properties.Common.Id, "global bus")); // this is used for identification in #toString
### Listener subscription
ListeningBean listener = new ListeningBean();
Expand Down Expand Up @@ -180,51 +181,56 @@ There is ongoing effort to extend documentation and provide code samples and det

<h2>Release Notes</h2>

Release notes have been moved to the [changelog](changelog)
Release notes moved to the [changelog](./changelog).

##Integrations



<h2>Roadmap</h2>
Check the issues labeled 'enhancement'. Comment if you would like to see the feature in a future release and/or want to share
your ideas on the feature (or a variation thereof).
Please understand that I have limited time to include new features and that I will focus on stability and cleaner APIs.
Adding features only works with well designed and thoroughly tested components. This is especially true for multi-threaded code
and I am still not 100 percent happy with the existing test design and some parts of the internal code layout.
There is no roadmap planning going on that deserves hte name. There is a collection of useful features though. Check the issues labeled with [enhancement](https://github.com/bennidi/mbassador/labels/enhancement) or the available milestones. Comment if you would like to see the feature in a future release and/or want to share your ideas on the feature (or a variation thereof).

Please understand that I have limited time to include new features and that I will focus on stability and cleaner APIs. Adding features only works with well designed and thoroughly tested components. This is especially true for multi-threaded code and I am still not 100 percent convinced by the existing test design and some parts of the internal code layout.

Planned for release:Spring integration with support for conditional message dispatch in transactional context (dispatch only after
successful transaction commit etc.). Currently in beta, see <a href="https://github.com/bennidi/mbassador-spring">this</a> repository
Planned for release: [Spring integration](bennidi/mbassador-spring) (currently in beta state) with support for conditional message dispatch in transactional context (dispatch only after successful transaction commit etc.).


<h2>Credits</h2>
The initial inspiration for creating this component comes from Google Guava's event bus implementation.
I liked the simplicity of its design and I do trust the developers at Google a lot, so I was happy to find that they also
provided an event bus system. The main reason it proved to be unusable for our scenario was that it uses strong references
to the listeners such that every object has to be explicitly unsubscribed.
I liked the simplicity of its design and I trust in the code quality of google libraries. The main reason it proved to be unusable for our scenario was that it uses strong references to the listeners.

I want to thank the development team from [friendsurance](www.friendsurance.de) for their support and feedback on the bus
implementation and the management of friendsurance for allowing me to publish the component as an open source project.
I want to thank the development team from [friendsurance](www.friendsurance.de) for their support and feedback on the bus implementation and the management for allowing me to publish the component as an open source project.

I also want to thank all of the github users who have made little or larger [contributions](https://github.com/bennidi/mbassador/pulls?q=is%3Apr+is%3Aclosed). Thank you boys and girls, it is awesome to see
the open source idea working.
Special thanks go to
+ [arne-vandamme](http://github.com/arne-vandamme) for adding support for [meta-annotations](https://github.com/bennidi/mbassador/pull/74)
+ [Bernd Rosstauscher](http://github.com/Rossi1337) for providing an initial integration with JUEL
+ [David Sowerby](http://github.com/davidsowerby) for providing guidance for other users and his various PR on better error handling
+ [dorkbox](http://github.com/dorkbox) for various PRs and his incredible [work on performance tuning](http://github.com/bennidi/eventbus-performance/issues/1) which is still to be integrated.

+ [David Sowerby](http://github.com/davidsowerby) for answering user questions, for his tutorial on [guice integration](bennidi/mbassador/wiki/guice-integration) and his various PRs
+ [dorkbox](http://github.com/dorkbox) for various PRs and his incredible [work on performance tuning](http://github.com/bennidi/eventbus-performance/issues/1) which is still to be integrated
+ [durron597](http://github.com/durron597) for his many PRs and the help he offered by answering user questions

Many thanks also to ej-technologies for providing me with an open source license of
[![JProfiler](http://www.ej-technologies.com/images/banners/jprofiler_small.png)](http://www.ej-technologies.com/products/jprofiler/overview.html)
and Jetbrains for a license of [IntelliJ IDEA](http://www.jetbrains.com/idea/)

And all the other open source projects that make this kind of development possible:

* [jUnit](http://www.junit.org)
* [maven](http://www.maven.org)
* [mockito](http://www.mockito.org)
* [slf4j](http://www.slf4j.org)
* [Odysseus JUEL](http://juel.sourceforge.net/guide/start.html)


Special thanks also to [Sonatype](http://www.sonatype.com/) for the hosting of their [oss nexus repository](https://oss.sonatype.org/).


<h2>Contribute</h2>

Any feature requests and feedback are more than welcome. You may suggest improvements either by submitting an
issue or by forking the repo and creating a pull request. I will try to respond as quickly as possible.
Any feature requests and feedback are more than welcome. You may suggest improvements or report bugs either by submitting an issue - I will try to respond as quickly as possible. Please try to be precise in the description of your requirements. Following a hands-on mentality please feel invited to contribute by by forking the repo and creating a pull request to submit the code you would like to be included. Make your PRs small and provide test code! Take a look at [this issue](bennidi/mbassador#106) for a good example.

Sample code and documentation are both very appreciated contributions. Especially integration with different frameworks
such as Spring, Guice or other is of great value. Feel free and welcome to create Wiki pages to share your code and ideas.
Sample code and documentation are both very appreciated contributions. Especially integration with different frameworks is of great value. Feel free and welcome to create Wiki pages to share your code and ideas. Example: [Guice integration](bennidi/mbassador/wiki/guice-integration)

<h2>License</h2>

Expand Down
Expand Up @@ -5,7 +5,7 @@
import java.util.*;

/**
* The bus configuration holds various parameters that can be used to customize the bus' runtime behaviour.
* {@inheritDoc}
*/
public class BusConfiguration implements IBusConfiguration {

Expand Down
Expand Up @@ -61,6 +61,7 @@ public interface IBusConfiguration{

/**
* Add a handler that is called when a misconfiguration is detected.
* Note: Not fully implemented, yet.
*/
IBusConfiguration addConfigurationErrorHandler(ConfigurationErrorHandler handler);

Expand Down
8 changes: 4 additions & 4 deletions src/test/java/net/engio/mbassy/DeadMessageTest.java
Expand Up @@ -8,7 +8,7 @@
import net.engio.mbassy.common.TestUtil;
import net.engio.mbassy.listener.Handler;
import net.engio.mbassy.listeners.IMessageListener;
import net.engio.mbassy.listeners.MessagesListener;
import net.engio.mbassy.listeners.MessagesTypeListener;
import net.engio.mbassy.listeners.ObjectListener;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -36,9 +36,9 @@ public void testDeadMessage(){
.create(InstancesPerListener, IMessageListener.DefaultListener.class)
.create(InstancesPerListener, IMessageListener.AsyncListener.class)
.create(InstancesPerListener, IMessageListener.DisabledListener.class)
.create(InstancesPerListener, MessagesListener.DefaultListener.class)
.create(InstancesPerListener, MessagesListener.AsyncListener.class)
.create(InstancesPerListener, MessagesListener.DisabledListener.class)
.create(InstancesPerListener, MessagesTypeListener.DefaultListener.class)
.create(InstancesPerListener, MessagesTypeListener.AsyncListener.class)
.create(InstancesPerListener, MessagesTypeListener.DisabledListener.class)
.create(InstancesPerListener, DeadMessagHandler.class)
.create(InstancesPerListener, Object.class);

Expand Down
24 changes: 12 additions & 12 deletions src/test/java/net/engio/mbassy/SubscriptionManagerTest.java
Expand Up @@ -65,15 +65,15 @@ public void testAbstractMessageListener(){
@Test
public void testMessagesListener(){
ListenerFactory listeners = listeners(
MessagesListener.DefaultListener.class,
MessagesListener.AsyncListener.class,
MessagesListener.DisabledListener.class,
MessagesListener.NoSubtypesListener.class);
MessagesTypeListener.DefaultListener.class,
MessagesTypeListener.AsyncListener.class,
MessagesTypeListener.DisabledListener.class,
MessagesTypeListener.NoSubtypesListener.class);

SubscriptionValidator expectedSubscriptions = new SubscriptionValidator(listeners)
.listener(MessagesListener.NoSubtypesListener.class).handles(MessageTypes.class)
.listener(MessagesListener.DefaultListener.class).handles(MessageTypes.class)
.listener(MessagesListener.AsyncListener.class).handles(MessageTypes.class);
.listener(MessagesTypeListener.NoSubtypesListener.class).handles(MessageTypes.class)
.listener(MessagesTypeListener.DefaultListener.class).handles(MessageTypes.class)
.listener(MessagesTypeListener.AsyncListener.class).handles(MessageTypes.class);

runTestWith(listeners, expectedSubscriptions);
}
Expand Down Expand Up @@ -151,9 +151,9 @@ public void testMultipleMessageListeners(){
IMultipartMessageListener.DefaultListener.class,
IMultipartMessageListener.AsyncListener.class,
IMultipartMessageListener.DisabledListener.class,
MessagesListener.DefaultListener.class,
MessagesListener.AsyncListener.class,
MessagesListener.DisabledListener.class);
MessagesTypeListener.DefaultListener.class,
MessagesTypeListener.AsyncListener.class,
MessagesTypeListener.DisabledListener.class);

SubscriptionValidator expectedSubscriptions = new SubscriptionValidator(listeners)
.listener(ICountableListener.DefaultListener.class)
Expand All @@ -162,8 +162,8 @@ public void testMultipleMessageListeners(){
.handles(MultipartMessage.class, IMultipartMessage.class, ICountable.class, StandardMessage.class)
.listener(IMultipartMessageListener.DefaultListener.class).handles(MultipartMessage.class, IMultipartMessage.class)
.listener(IMultipartMessageListener.AsyncListener.class).handles(MultipartMessage.class, IMultipartMessage.class)
.listener(MessagesListener.DefaultListener.class).handles(MessageTypes.class)
.listener(MessagesListener.AsyncListener.class).handles(MessageTypes.class);
.listener(MessagesTypeListener.DefaultListener.class).handles(MessageTypes.class)
.listener(MessagesTypeListener.AsyncListener.class).handles(MessageTypes.class);

runTestWith(listeners, expectedSubscriptions);
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/net/engio/mbassy/SyncAsyncTest.java
Expand Up @@ -53,7 +53,7 @@ public void run() {
MessageTypes.resetAll();
ConcurrentExecutor.runConcurrent(publishAndCheck, ConcurrentUnits);
assertEquals(InstancesPerListener * ConcurrentUnits, MessageTypes.Simple.getTimesHandled(IMessageListener.DefaultListener.class));
assertEquals(InstancesPerListener * ConcurrentUnits, MessageTypes.Simple.getTimesHandled(MessagesListener.DefaultListener.class));
assertEquals(InstancesPerListener * ConcurrentUnits, MessageTypes.Simple.getTimesHandled(MessagesTypeListener.DefaultListener.class));
}


Expand Down Expand Up @@ -89,7 +89,7 @@ public void run() {
messageManager.waitForMessages(waitForMessageTimeout);

MessageTypes.resetAll();
messageManager.register(MessageTypes.Simple, InstancesPerListener * ConcurrentUnits, IMessageListener.AsyncListener.class, MessagesListener.AsyncListener.class);
messageManager.register(MessageTypes.Simple, InstancesPerListener * ConcurrentUnits, IMessageListener.AsyncListener.class, MessagesTypeListener.AsyncListener.class);
ConcurrentExecutor.runConcurrent(publishAndCheck, ConcurrentUnits);
messageManager.waitForMessages(waitForMessageTimeout);
}
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/net/engio/mbassy/SyncBusTest.java
Expand Up @@ -16,7 +16,7 @@
import net.engio.mbassy.listeners.CustomInvocationListener;
import net.engio.mbassy.listeners.ExceptionThrowingListener;
import net.engio.mbassy.listeners.IMessageListener;
import net.engio.mbassy.listeners.MessagesListener;
import net.engio.mbassy.listeners.MessagesTypeListener;
import net.engio.mbassy.messages.MessageTypes;
import net.engio.mbassy.messages.MultipartMessage;
import net.engio.mbassy.messages.StandardMessage;
Expand Down Expand Up @@ -44,8 +44,8 @@ public void testSynchronousMessagePublication() throws Exception {
ListenerFactory listeners = new ListenerFactory()
.create(InstancesPerListener, IMessageListener.DefaultListener.class)
.create(InstancesPerListener, IMessageListener.DisabledListener.class)
.create(InstancesPerListener, MessagesListener.DefaultListener.class)
.create(InstancesPerListener, MessagesListener.DisabledListener.class)
.create(InstancesPerListener, MessagesTypeListener.DefaultListener.class)
.create(InstancesPerListener, MessagesTypeListener.DisabledListener.class)
.create(InstancesPerListener, Object.class);


Expand Down Expand Up @@ -75,8 +75,8 @@ public void run() {
ConcurrentExecutor.runConcurrent(publishAndCheck, ConcurrentUnits);
assertEquals(InstancesPerListener * ConcurrentUnits, MessageTypes.Simple.getTimesHandled(IMessageListener.DefaultListener.class));
assertEquals(InstancesPerListener * ConcurrentUnits, MessageTypes.Multipart.getTimesHandled(IMessageListener.DefaultListener.class));
assertEquals(InstancesPerListener * ConcurrentUnits, MessageTypes.Simple.getTimesHandled(MessagesListener.DefaultListener.class));
assertEquals(InstancesPerListener * ConcurrentUnits, MessageTypes.Multipart.getTimesHandled(MessagesListener.DefaultListener.class));
assertEquals(InstancesPerListener * ConcurrentUnits, MessageTypes.Simple.getTimesHandled(MessagesTypeListener.DefaultListener.class));
assertEquals(InstancesPerListener * ConcurrentUnits, MessageTypes.Multipart.getTimesHandled(MessagesTypeListener.DefaultListener.class));
}


Expand Down
20 changes: 8 additions & 12 deletions src/test/java/net/engio/mbassy/listeners/Listeners.java
Expand Up @@ -3,40 +3,36 @@
import java.util.*;

/**
* Created with IntelliJ IDEA.
* User: benjamin
* Date: 6/26/13
* Time: 11:48 AM
* To change this template use File | Settings | File Templates.
* Convenience class to create sets of listeners that can be reused on different test scenarios.
*/
public class Listeners {

private static final List<Class> Synchronous = Collections.unmodifiableList(Arrays.asList(new Class[]{
MessagesListener.DefaultListener.class,
MessagesTypeListener.DefaultListener.class,
IMessageListener.DefaultListener.class,
StandardMessageListener.DefaultListener.class,
MultipartMessageListener.DefaultListener.class,
ICountableListener.DefaultListener.class,
IMultipartMessageListener.DefaultListener.class}));

private static final List<Class> Asynchronous = Collections.unmodifiableList(Arrays.asList(new Class[]{
MessagesListener.AsyncListener.class,
MessagesTypeListener.AsyncListener.class,
IMessageListener.AsyncListener.class,
StandardMessageListener.AsyncListener.class,
MultipartMessageListener.AsyncListener.class,
ICountableListener.AsyncListener.class,
IMultipartMessageListener.AsyncListener.class}));

private static final List<Class> SubtypeRejecting = Collections.unmodifiableList(Arrays.asList(new Class[]{
MessagesListener.NoSubtypesListener.class,
MessagesTypeListener.NoSubtypesListener.class,
IMessageListener.NoSubtypesListener.class,
StandardMessageListener.NoSubtypesListener.class,
MultipartMessageListener.NoSubtypesListener.class,
ICountableListener.NoSubtypesListener.class,
IMultipartMessageListener.NoSubtypesListener.class}));

private static final List<Class> NoHandlers = Collections.unmodifiableList(Arrays.asList(new Class[]{
MessagesListener.DisabledListener.class,
MessagesTypeListener.DisabledListener.class,
IMessageListener.DisabledListener.class,
StandardMessageListener.DisabledListener.class,
MultipartMessageListener.DisabledListener.class,
Expand All @@ -52,9 +48,9 @@ public class Listeners {
IMultipartMessageListener.DefaultListener.class,
IMultipartMessageListener.AsyncListener.class,
IMultipartMessageListener.NoSubtypesListener.class,
MessagesListener.DefaultListener.class,
MessagesListener.AsyncListener.class,
MessagesListener.NoSubtypesListener.class,
MessagesTypeListener.DefaultListener.class,
MessagesTypeListener.AsyncListener.class,
MessagesTypeListener.NoSubtypesListener.class,
StandardMessageListener.DefaultListener.class,
StandardMessageListener.AsyncListener.class,
StandardMessageListener.NoSubtypesListener.class,
Expand Down
Expand Up @@ -9,7 +9,7 @@
* @author bennidi
* Date: 5/24/13
*/
public class MessagesListener {
public class MessagesTypeListener {

private static abstract class BaseListener {

Expand Down

0 comments on commit 5bc924c

Please sign in to comment.