Service Patterns

Baratine is a flexible service framework based on application APIs. Because of its flexibility, it can be used in many independent patterns, from full single-page applications using Baratine as a responsive WebSocket server, to in-memory data microservices powering a service tier, to small solutions inside existing applications for queuing and singleton needs.

Applications need services in different configurations. Some just need small services in an existing application. Others need a dedicated server. Baratine has three main deployment models:

  • Servlet web-app for internal services
  • Baratine server for distribution, in-memory and failover
  • Embedded Baratine manager for internal services in any Java VM

While many of the Baratine patterns are useful in all three deployment patterns, some of the more advanced patterns require a Baratine server deployment for sharding, single-ownership and failover.

Several of the patterns are useful embedded in a non-service application, for example the module service, and the singleton service. Others are most useful deployed in a Baratine server cluster, for example the sharded data store and failover services.

Hello Patterns

Hello World (Single Page Application) ../_images/example-hello-server.png
Hello World Tour (Tour of Baratine using Hello World) ../_images/example-hello.png

Single-Page Application Patterns

Single-Page Session (Single Page Application Session) ../_images/example-hello-server.png
Protocol for Existing Module (JAMP and WebSocket in Servlet Container) ../_images/example-protocol-module.png

Local/Embedded Patterns

Singleton Resource (Singleton Resource Service) ../_images/example-singleton.png
Queue with Application API (Active Queue) ../_images/example-queue.png
Local Microservice (for Existing Module) ../_images/example-module.png
Data Access Service (Hibernate Gateway) ../_images/example-gateway.png
Publish/Subscribe Events (API-based pub/sub) ../_images/example-pubsub-events.png

Baratine Server Patterns

Microservice ../_images/example-protocol-module.png
In Memory with External Database (using data-access service as a gateway) ../_images/example-sharding-db.png
In-Memory Persistence with store: Service ../_images/example-single-store.png
Tutorial: Setting up a Cluster (multi-server sharded service) ../_images/example-sharding-facade.png
Publish/Subscribe Stream (pubsub streaming) ../_images/example-pubsub-remote.png

Extended Patterns

Callback Pinned to Service (callback pinned to service) ../_images/example-callback-pin.png
Facade to User and Auction (Facade for multiple Services) ../_images/example-facade-solo.png
REST Service (REST Service) ../_images/example-protocol-module.png
List saved with Baratine store: (Single-item with store:) ../_images/example-single-store.png
Tutorial: Child Services (child services with store:) ../_images/example-multi-store.png
Multiple named lists saved with Baratine store: (multi-item with store:) ../_images/example-multi-store.png
URL-based sharding with Baratine store: (multi-item url-sharding with facade) ../_images/example-sharding.png