Giter VIP home page Giter VIP logo

service-bus's Issues

Change Definition of ServiceBusManager aliases

At the moment the aliases defined in Definition are used in the ServiceBusManager to point to the default implementations. The aliases are defined like they are used within a ZF2 ServiceManager (without underscores, etc.). The spelling do not answer to configuration keys, so the notation should be adapted and usage in ServiceBusManager, too.

Implement LocalQueueSetup ListenerAggregate

The LocalQueueSetup should register itself to the ServiceBusInitializationEvent.
During the Event it should activate the InMemoryMessageDispatcher and add the CommandRceiverManager to the localQueue mapping of the InMemoryMessageDispatcher.

Introduce direct message routing

The LocalSynchronousInitiliazer is no good default. Most times you will use the ServiceBus for simple synchronous command/event dispatching. The complete message translation via bus, message dispatcher and receiver is just overhead for this use case.

A simpler solution is required. The idea is that the ServiceBus#route method looks for direct_command_map and direct_event_map configuration. These maps are simple dictionaries where the key is the message name and the value is the handler alias of the services configuration of the ServiceBus. So the ServiceBus can directly detect the appropriate handler an invoke it with the help of an InvokeStrategy.

The LocalSynchronousInitiliazer is no longer required and can be removed.

Depends On

Sub-Tasks

Add apigility integration

Provide a generic messagebox endpoint to receive commands from the client. Each command type should have an own messagebox, so that you can document the different commands like you would document resources.

A messagebox should answer with a HTTP Status code and with a hypermedia link to an endpoint where client can check the status of the command: pending, succeeded, failed, ....

Provide helper to add hal links to resources pointing to available commands for the resource.

Also provide an event-stream endpoint, so that a client can query for published events.

Remove config root

The config root comes in play when ServiceBus is integrated in ZF2 but this should be manged by the integration module.

Provide FactoryPluginManagers

Commands-, Events- and MessagesFactories should also be derived from PluginManagers by passing the FQCNs to them. So you can register different factories for different types of commands, events, messages.

Add MessageFactory

Define an interface with two methods: fromCommand and fromEvent.
Implement a MessageFactory.
Let CommandBus use the MessageFactory by default and make it possible, that MessageFactory can be exchanged. like the CommandFactory in a CommandReceiver

Improve event system

Design specific events for all actions and let listener change the arguments, f.e. switch queue in a MessageDispatcher, etc.

Add type to message header

The header of a message should provide information of the original type of the message (command or event).

Change InMemoryMessageDispatcher to check the type and use the correct *Receiver

Implement EventReceiver

We need an EventReceiver that receives events from a queue and publish them to local listeners.

Improve bus initialization logic

The default command/event bus factories do not check if they can create the requested bus. It would be better, if they check the configuration in the canCreateService method and not in the createServiceWithName method. So the ServiceBusManager can fall back to direct routing if requested bus is not available but ServiceBusManager has a mapping for the message.

With this change in mind you can know send a message on a non existing topic bus and if you later decide to route this topic to a asynchronous message dispatcher, you can do so by simply add a configuration for the topic bus.

Add EventManager to all components

Each component should provide an own EventManager and trigger pre and post events in all public methods.
The ServiceBusManager should addionally trigger an ServiceBusInitializationEvent.

Add optional message tracking mechanism

Design a consistent status API that can be added via initializer and listen to the various message dispatcher, receiver and routing events to track status of published messages.
Look at the resque example for inspiration.

Depends On

  • #30 tracking of errors should be possible, too

Implement default setup of ServiceBus

By default the ServiceBus should be configured with a CommandBus, CommandReceiver, EventBus, EventReceiver, local Queue and InMemoryMessageDispatcher in place.

Enable direct attach of CommandHandlers and EventListeners to ease the setup for a new client. It should be possible to explore the system iterative.

Add error handling of handling errors

When the ServiceBus invokes a command or event on a handler, exceptions should be catched and an error event should be triggered containing a raiseException flag which defaults to true but can be changed by a listener if error is handled in another way, f.e. delivery of the message is retried.

Use services key for configuring the ServiceBusLocator

Currently you have to define ServiceLocator configuration for the ServiceBus under the root config key. This is confusing and should be changed. The ServiceLocator config can be organized under the key "service_bus_manager".

DispatchException captures wrong process phase

When an exception is thrown during message dispatch the CommandDispatchException or EventDispatchException should use the current event name of the Dispatch to give a hint in which phase the exception was thrown, but the phase is always finalize cause finalize is always triggered whether the dispatch was successful or not.

Publish events to many EventHandlers

Other than a CommandReceiver, an EventReceiver should publish an Event to many EventHandlers.

Change event_map structure to allow an array of EventHandlers for a specific Event.
Let EventReceiver check if one handler or a collection of handlers is configrued.
Let EventReceiver publish event to all configured handlers.

Add a query bus

  • QueryDispatch
  • QueryRouter
  • QueryBus returning a promise
  • Align invoke strategies
  • Add a MessageDispatcher\RemoteQueryDispatcher interface

Update docs for v4.0

Docs need to be aligned due to upgrade to prooph/common v3.x and remove of ZF2\Events.

Remove queue component

Queues are not really necessary. The original intention was to use them for topic based routing but it is enough to use the command bus name for this kind of purpose.

Implement RESTfulMessageDispatcher as ZF2 Module

The RESTfulMessageDispatcher can be used to publish commands and events as resources and to receive them from a client. The RESTfulMessageDispatcher should be provided as ZF2 Module, cause we need REST controllers and a Database. To much dependencies to include it in the core service bus.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.