Class LlmCallbackProcessor
Processes inbound webhook callbacks from async-batch LLM APIs (Anthropic
Message Batches, OpenAI Batch, vLLM batch endpoints, ...).
Wire it into a vanilla HTTP route — no llm-callback:// scheme:
r.From("http:0.0.0.0:5099/api/llm/callback?inOut=true")
.Process(new LlmCallbackProcessor())
.Choice()
.When(e => (bool)e.In.Headers[LlmHeaders.BatchDuplicate]!).Stop()
.End()
.To("direct:llm-batch-handler");
Behaviour:
Resolve the batch id (header → query → JSON body in this order).Deduplicate via , keyed on
"batch:<batchId>". A duplicate sets
=true and stops further work.If an is registered, load the original
submission to populate ,
, .Mark the batch completed and confirm idempotency.
The processor never fetches results from the provider on its own — that
step belongs to a follow-up route or the host application. It only
guarantees a single, conversation-aware delivery of every callback.
public sealed class LlmCallbackProcessor : IProcessor
Inheritance
Implements
Methods
Process(IExchange, CancellationToken)
Processes the exchange asynchronously.
public Task Process(IExchange exchange, CancellationToken ct = default)
Constructors
LlmCallbackProcessor(IToolIdempotencyStore, IBatchStore?, IConversationStore?, LlmCallbackOptions?)
Creates a callback processor.