Messaging & events

Akka has built-in messaging capabilities that should be your primary path. These are durable, integrated with the runtime, and require no external infrastructure.

Akka-native messaging

Akka provides several built-in patterns for event-driven communication:

  • Service-to-service eventing — Components within and across Akka services communicate through durable event streams. No broker required.

  • Brokerless pub/sub — Event Sourced Entities emit events to a journal that other components subscribe to directly.

  • Event-driven Consumers — Subscribe to Entity events, key-value state changes, or Workflow transitions and react to them in real time.

Akka handles end-to-end backpressure automatically and uses the event journal as a durable buffer to decouple producers and consumers. You implement the handler function; Akka manages the stream lifecycle.

Examples of built-in streaming:

  • Views are updated asynchronously from a stream of events. You implement the update handler.

  • Views can stream query results, with the receiver controlling the pace.

  • Consumers process event streams from Entities, other services, or message broker topics.

  • Consumers can produce events to other services or publish to a message broker topic.

For more advanced streaming needs, you can use Akka Streams directly. See the Akka libraries documentation and Alpakka for streaming connectors.

External message brokers

When you need to integrate with systems outside Akka, use external message brokers. Akka offers built-in integrations for:

  • Kafka — via hosted services (Confluent Cloud, AWS MSK, Aiven)

  • Google Cloud Pub/Sub

  • Azure Event Hubs

For these built-in technologies, Akka decouples the broker configuration from the implementation of the Consumer or Producer. The topic name is referenced independently of the broker technology, as demonstrated in Consume from a message broker Topic and Producing to a message broker Topic. All connection details are managed at the Akka project level. For configuration instructions, refer to Configure message brokers.

Testing with message brokers

The Akka SDK testkit has built-in support for simulating message brokers. See Testing the integration for details. For running locally with a broker, refer to running a service with broker support.

Other broker technologies

Other message broker technologies can be integrated by using their Java client libraries directly. The Alpakka project also provides Akka-native connectors for many external services.

Webhooks

Implement webhooks for external system callbacks using HTTP Endpoints. Define a route that accepts the webhook payload and routes it to the appropriate component.