Эта страница ещё не переведена
Ниже показан английский оригинал.
container_id
container_id names the service to the broker, which is how an operator finds its links in the broker's console; the default is ruststream.
Every AMQP 1.0 connection opens with a container id, the name of the process on each end. Each link the service attaches takes its name from it, with a role and a number that keeps the name unique on the connection:
| Link | Name |
|---|---|
| a subscription's receiver | <container>-receiver-<n> |
| a publisher's sender, one per address | <container>-sender-<n> |
| the reply link of a request | <container>-reply-<n> |
| the controller of a transaction | <container>-txn-<n> |
The generated AsyncAPI document reports the container id beside the server's host and port, in the x-ruststream-amqp1 extension.
Example
The service presents itself to the broker as orders-svc.
- Macros
- Manual
/// The broker, which knows this service as `orders-svc`.
fn broker() -> AmqpBroker {
AmqpBroker::new("amqp://artemis:artemis@broker.internal:5672").container_id("orders-svc")
}
#[ruststream::app]
fn app() -> impl App<State = ()> {
RustStream::new(AppInfo::new("orders", "0.1.0")).with_broker(broker(), |b| {
b.include(place);
})
}
/// The broker, which knows this service as `orders-svc`.
fn broker() -> AmqpBroker {
AmqpBroker::new("amqp://artemis:artemis@broker.internal:5672").container_id("orders-svc")
}
fn app() -> impl App<State = ()> {
RustStream::new(AppInfo::new("orders", "0.1.0")).with_broker(broker(), |b| {
let place = subscriber(AmqpAddress::queue("orders"), Place);
b.include(place.build());
})
}