Browse component
The
browsecomponent keeps the messages sent to it in memory so they can be listed later, and passes them on to a consuming route if there is one.
Scheme: browse: · Crate: cameleer-core · Cargo feature: none, always included (build features) ·
Consumer: yes · Producer: yes · Apache Camel: Browse
When to use it
- Keep the last rejected or failed messages for inspection while debugging.
- Show recent messages of a route on a status page or to an operator tool.
- Record what passed a point in a route during development.
URI format
browse:name[?options]Example
- route:
id: record-rejections
from:
uri: direct:reject
steps:
- setHeader:
name: rejectedAt
simple: "${date:now:yyyy-MM-dd'T'HH:mm:ss}"
- to: browse:rejected?browseLimit=100The last 100 rejected messages are kept. List them from Rust with
cameleer_core::component::browse::browse_exchanges(&ctx, "browse:rejected?browseLimit=100").
Rust DSL
use cameleer_core::prelude::*;
pub fn routes(ctx: &CamelContext) -> Result<()> {
ctx.add_routes(|b| {
b.from("direct:reject")
.route_id("record-rejections")
.set_header("rejectedAt", simple("${date:now:yyyy-MM-dd'T'HH:mm:ss}"))
.to("browse:rejected?browseLimit=100");
})
}Options
| option | default | description |
|---|---|---|
browseLimit | unlimited | Maximum number of exchanges kept; older ones are dropped. |
synchronous | Accepted and ignored. |
Message headers
None added.
Run it with Docker
docker run --rm -v "$PWD:/routes:ro" pmsudhi/cameleer run /routes/rejections.camel.yamlCommon questions
Does browse keep messages after a restart?
No. They are in memory only. Write them to a file or a broker when you need to keep them.
Can another route consume from a browse endpoint?
Yes. from: browse:rejected receives each message synchronously as it is sent, and the message is still
kept for browsing.
Related
Found a problem?
If something on this page doesn't match what Cameleer does, or you hit a bug while building
with it, please help fix it, whether you are a person or a coding agent:
open an issue that describes what you saw,
then fork the repository, fix it, add or update a test, run cargo test --workspace, and open
a pull request. CONTRIBUTING.md
explains the ground rules.