# Stream Applications

在某些情况下，当 Stream 需要使用不同的消息中间件时，Stream 可以将其Applications 绑定到多个 spring cloud stream binders。在这些情况下，正确的配置 Applictations 的 binders 非常重要。例如，以下配置的 transform 转换器将会支持绑定Kafka和Rabbit：

```bash
http | multibindertransform --expression=payload.toUpperCase() | log
```

{% hint style="info" %}
在上面的示例中，您将编写自己的multibindertransform应用程序。
{% endhint %}

在此 Stream 中，每个 Applications 通过以下方式连接到消息传递中间件：

1. HTTP Source 将事件发送到RabbitMQ（`rabbit1`）。
2. Multi-Binder Transform处理器从RabbitMQ（`rabbit1`）接收事件，并将处理后的事件发送到Kafka（`kafka1`）。
3. log sink 从Kafka（`kafka1`）接收事件。

在这里，`rabbit1`和`kafka1`是spring cloud stream Applications 属性中给出的绑定器名称。 基于此设置，每个 Applications 包含的 binders 如下：

* HTTP: Rabbit binder
* Transform: Both Kafka and Rabbit binders
* Log: Kafka binder

spring-cloud-stream  `binder` 属性可以在 Applications 本身设置。如果没有，则可以在`deployment`部署 Stream 时传递属性，如以下示例所示：

```bash
dataflow:>stream create --definition "http | multibindertransform --expression=payload.toUpperCase() | log" --name mystream

dataflow:>stream deploy mystream --properties "app.http.spring.cloud.stream.bindings.output.binder=rabbit1,app.multibindertransform.spring.cloud.stream.bindings.input.binder=rabbit1,
app.multibindertransform.spring.cloud.stream.bindings.output.binder=kafka1,app.log.spring.cloud.stream.bindings.input.binder=kafka1"
```

可以通过部署属性指定`binder`配置属性，从而覆盖任何`binder`配置属性。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cxz.gitbook.io/spring-cloud-date-flow/streams/stream-applications.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
