Pousse-Café - Spring Bridge

Pousse-Café is a framework assisting in writing DDD-based applications

License

License

GroupId

GroupId

org.pousse-cafe-framework
ArtifactId

ArtifactId

pousse-cafe-spring
Last Version

Last Version

0.15.0
Release Date

Release Date

Type

Type

jar
Description

Description

Pousse-Café - Spring Bridge
Pousse-Café is a framework assisting in writing DDD-based applications
Source Code Management

Source Code Management

http://github.com/pousse-cafe/pousse-cafe-spring

Download pousse-cafe-spring

How to add to project

<!-- https://jarcasting.com/artifacts/org.pousse-cafe-framework/pousse-cafe-spring/ -->
<dependency>
    <groupId>org.pousse-cafe-framework</groupId>
    <artifactId>pousse-cafe-spring</artifactId>
    <version>0.15.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.pousse-cafe-framework/pousse-cafe-spring/
implementation 'org.pousse-cafe-framework:pousse-cafe-spring:0.15.0'
// https://jarcasting.com/artifacts/org.pousse-cafe-framework/pousse-cafe-spring/
implementation ("org.pousse-cafe-framework:pousse-cafe-spring:0.15.0")
'org.pousse-cafe-framework:pousse-cafe-spring:jar:0.15.0'
<dependency org="org.pousse-cafe-framework" name="pousse-cafe-spring" rev="0.15.0">
  <artifact name="pousse-cafe-spring" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.pousse-cafe-framework', module='pousse-cafe-spring', version='0.15.0')
)
libraryDependencies += "org.pousse-cafe-framework" % "pousse-cafe-spring" % "0.15.0"
[org.pousse-cafe-framework/pousse-cafe-spring "0.15.0"]

Dependencies

provided (3)

Group / Artifact Type Version
org.pousse-cafe-framework : pousse-cafe-core jar 0.24.0
org.springframework : spring-beans jar 5.3.1
org.springframework : spring-context jar 5.3.1

test (2)

Group / Artifact Type Version
junit : junit jar 4.13.1
org.springframework : spring-test jar 5.3.1

Project Modules

There are no modules declared in this project.

Travis build status Maven status

Pousse-Cafe-Spring

This project provides a bridge between Pousse-Café and Spring. It enables the injection of Pousse-Café components into Spring beans. For instance, you can use Spring's @Autowired annotation to inject one of your Pousse-Café repositories into a Spring REST controller (i.e. a bean annotated with @RestController).

It also enables the injection of Spring beans in some Pousse-Café components:

  • Services,
  • Repositories,
  • Data Accesses,
  • Factories,
  • TransactionRunner,
  • MessageSendingPolicy.

Note that injecting Spring Beans in Domain components is not recommended as you might mix up non-domain and domain logic. In some particular cases however, this might be the preferred approach (e.g. when domain services rely on non-domain features like sending e-mails, etc.).

Below an example of configuration file to add to your application in order to automatically build and start a Pousse-Café Runtime:

@Configuration
@Import(RuntimeConfiguration.class) // Enables the bridge
public class YourConfiguration {

    @Override
    protected Bundles bundles(Messaging messaging,
            Storage storage) {
        MessagingAndStorage messagingAndStorage = new MessagingAndStorage(messaging, storage);
        return new Bundles.Builder()
            // Register your bundles here using withBundle and use messagingAndStorage
            // when building them
            .build();
    }
}

Note that if you are using a custom Messaging and/or Storage, you'll have to use the specific types for bundles method's arguments.

Finally, note that a Spring Bean may define custom message listeners (i.e. contain methods annotated with @MessageListener). In that case, extending MessageListeningBean automatically registers the listeners upon Bean's initialization.

Properties

The following properties are used to customize Pousse-Café Runtime:

  • poussecafe.core.failOnDeserializationError: flag telling of deserialization errors should be considered as failures or not (default is false)
  • poussecafe.core.processingThreads: the number of processing threads to start for message consumption (default is 1)
  • poussecafe.core.consumptionMaxRetries: the maximum number of consumption retries in case of collision (default is 50)
  • poussecafe.core.consumptionBackOffCeiling: the ceiling for back-off algorithm in case of collision (default is 10)
  • poussecafe.core.consumptionBackOffSlotTime: the slot time for back-off algorithm in case of collision (default is 3.0)

Also, properties with keys starting with poussecafe.config. are automatically added to Runtime's configuration. For example, property poussecafe.config.X = Y will cause configuration to contain have value Y with key X.

Configure your Maven project

Add the following snippet to your POM:

<dependency>
    <groupId>org.pousse-cafe-framework</groupId>
    <artifactId>pousse-cafe-spring</artifactId>
    <version>${poussecafe.spring.version}</version>
</dependency>
org.pousse-cafe-framework

Pousse-Café

Pousse-Café is a framework assisting you in writing applications following Domain Driven Design methodology

Versions

Version
0.15.0
0.14.0
0.13.0
0.12.0
0.11.0
0.10.0
0.9.0
0.8.0
0.7.1
0.7.0
0.6.0
0.5.0
0.4.0
0.3.0
0.2.0