The terms "command" and "job" are used interchangeably. To understand the benefits which the job-bus offers, we should briefly understand the command pattern. Below I will describe the command pattern in the context of the job-bus; which might differ slightly from the command pattern as described in litera
ture. Simply speaking, you push a job into your job-bus. You can either wait for the job to be executed and grab its result when done or you us a handle to grab the result later on. The job is being executed asynchronously, it is up to the job-bus where and when it is being executed: For example the job could be transported to some remote JVM to be executed there or the job could get executed as soon as a worker thread is happy to grab the job from a job-queue.
To invoke a command (job), the job-bus, being the invoker, passes the context to the command (job) and requests the command (job) to apply its operation with regard to the context.
As you can see, the job-bus is responsible for managing the context and for invoking the command (job). This decouples the business logic from the knowledge on how to retrieve a context or where the command is actually being executed (more on this later).
As of the implemented handle paradigm, the job-bus may be used by various parties without revealing their command (job) instances (to each other) being processed by the job-bus.
Command
(job) instances and the according
handles. Only privileged systems should access the job-bus directory as any
system having access can intervene with the
Command
(job) instances without owning those
Command
(job) instances (without owning the
according handle).
(this scenario assumes that a) your command (job) is serializable as well as b) your result is serializable)
Interface | Description |
---|---|
JobBus<CTX,H> |
The
JobBus makes use of the Undoable pattern and is used to
execute job (Undoable ) instances by a client. |
JobBusDirectory<CTX,H> |
The
JobBusDirectory is actually a plain extension of the
JobBus providing access to all the handles currently being managed by
the JobBus . |
Class | Description |
---|---|
AbstractJobBus<CTX,H> |
The
AbstractJobBus implements the JobBus interface. |
AbstractJobBusDirectory<CTX,H> | |
JobBusDirectoryImpl<CTX> |
The
JobBusDirectoryImpl is a ready to use implementation of a
composite JobBusDirectory extending the
AbstractJobBusDirectory . |
JobBusImpl<CTX> |
The
JobBusImpl is a ready to use implementation of a composite
JobBus wrapping a JobBusDirectory (actually a JobBus
is sufficient) and delegating the method calls to the wrapped instances. |
JobBusProxyImpl<CTX,H> |
The
JobBusProxyImpl implements a JobBus proxy: a
JobBus proxy can use a remote JobBus whilst only delegating
those operations to the remote JobBus which can be handled on the
remote system. |
Copyright © 2018. All rights reserved.