Backend Development 11 min read

Introducing Flower: A Reactive Programming Framework for Microservice Systems

Flower is a Java‑based reactive programming framework built on Akka that enables developers to compose fine‑grained services into visualized, message‑driven flows, providing instant response, elasticity, and distributed asynchronous processing for high‑performance microservice architectures.

Tongcheng Travel Technology Center
Tongcheng Travel Technology Center
Tongcheng Travel Technology Center
Introducing Flower: A Reactive Programming Framework for Microservice Systems

With the rapid evolution of internet services, microservice architectures have become essential for accelerating development and iteration, yet ensuring instant response and resilience remains challenging. To address this, the Flower framework was created as a reactive programming solution built on Akka.

Basic Concepts : In Flower, a Service is the smallest unit of business logic, and a Message serves as both the input and output of services. Services are visually orchestrated into a Flow , forming a complete reactive system.

Core Principles include:

Instant Response : Callers receive immediate feedback without waiting for the entire service chain to finish.

Elasticity : The system self‑heals when services or servers fail, preventing crashes.

Scalability : Automatic resource scaling adapts to load pressure.

Message‑Driven : Services communicate solely via messages, eliminating direct method coupling.

Typical service definition example:

@FlowerService
public class ServiceA implements Service<User, Integer> {
  private static final Logger logger = LoggerFactory.getLogger(ServiceA.class);
  @Override
  public Integer process(User message, ServiceContext context) throws Exception {
    logger.info("message : {}, context:{}", message, context);
    context.getWeb().println(message.toString());
    return message.getId();
  }
}

Flows can be assembled programmatically or via configuration files, e.g.:

serviceFlow.buildFlow("sampleFlow", "serviceA", "serviceB");

or in flower.yaml :

name: "LocalFlower"
basePackage: com.ly.train.order.service
host: 127.0.0.1
port: 25004
registry:
  - url: "flower://127.0.0.1:8096?application=LocalFlower"

Distributed Asynchronous Solution : Flower stores service metadata in registries such as ZooKeeper, Redis, or Etcd, enabling service providers and consumers to discover each other and communicate asynchronously. Load‑balancing strategies (random or weighted round‑robin) select the next service instance.

Message Processing Modes cover:

Full broadcast – a message is sent to all downstream services for parallel execution.

Conditional routing – messages are dispatched to specific services based on type, embedded IDs, or a built‑in ConditionService .

Message aggregation – parallel results are collected by the built‑in AggregateService and forwarded as a single set.

Message reply – callers can optionally block to receive the final result of the flow.

In practice, a C#‑based internal system was migrated to Java using Flower. Performance tests showed that, under identical hardware, the refactored system achieved roughly double the TPS and more stable response times as thread counts increased.

Conclusion : Flower offers a developer‑friendly, message‑driven reactive framework that delivers high performance, low cost, and strong availability for microservice applications, without requiring developers to master functional programming.

Distributed SystemsJavaMicroservicesReactive ProgrammingAkkaFlower framework
Tongcheng Travel Technology Center
Written by

Tongcheng Travel Technology Center

Pursue excellence, start again with Tongcheng! More technical insights to help you along your journey and make development enjoyable.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.