Symfony bundle to integrate Broadway into your Symfony application.
Note: this bundle is far from complete. Please let us know (or send a pull
request) if you miss any configuration options, etc!
Register the bundle in your application kernel:
$bundles = array( // .. new Broadway\Bundle\BroadwayBundle\BroadwayBundle(), );
Note: in order to use the bundle you need some additional dependencies. See
the suggest key of the composer.json file.
Once enabled the bundle will expose several services, such as:
broadway.command_handling.command_buscommand bus to inject if you use commands
broadway.event_storealias to the active event store
broadway.uuid.generatoractive uuid generator
To generate the mysql schema for the event store use the following command
The schema can be dropped using
The bundle provides several tags to use in your service configuration.
Domain event listeners
Register listeners (such as projectors) that respond and act on domain events:
<tag name="broadway.domain.event_listener" />
For example an event listener that collects successfully executed commands:
<tag name="broadway.event_listener" event="broadway.command_handling.command_success" method="onCommandHandlingSuccess" />
It is possible to add additional metadata to persisted events. This is useful
for recording extra contextual (auditing) data such as the currently logged in
user, an ip address or some request token.
<tag name="broadway.metadata_enricher" />
Register sagas using the
broadway.saga service tag:
<service class="ReservationSaga"> <argument type="service" id="broadway.command_handling.command_bus" /> <argument type="service" id="broadway.uuid.generator" /> <tag name="broadway.saga" type="reservation" /> </service>
There are some basic configuration options available at this point. The
options are mostly targeted on providing different setups based on production
or testing usage.
Note: at this moment the bundle will always use the default doctrine database
connection for the event store
broadway: event_store: dbal: table: events use_binary: false # If you want to use UUIDs to be stored as BINARY(16), required DBAL >= 2.5.0 command_handling: logger: false # If you want to log every command handled, provide the logger's service id here (e.g. "logger") saga: repository: ~ # One of "in_memory"; "mongodb" read_model: repository: ~ # One of "in_memory"; "elasticsearch" elasticsearch: hosts: # Default: - localhost:9200 serializer: payload: ~ # default: broadway.simple_interface_serializer readmodel: ~ # default: broadway.simple_interface_serializer metadata: ~ # default: broadway.simple_interface_serializer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN