jiriOndrusek-agent commented on code in PR #30391:
URL: https://github.com/apache/camel/pull/30391#discussion_r4629726595


##########
components/camel-ai/camel-langchain4j-service/src/main/docs/langchain4j-service-component.adoc:
##########
@@ -0,0 +1,280 @@
+= LangChain4j Service Component
+:doctitle: LangChain4j Service
+:shortname: langchain4j-service
+:artifactid: camel-langchain4j-service
+:description: Invoke LangChain4j AI Services and agents from Camel routes.
+:since: 4.24
+:supportlevel: Preview
+:tabs-sync-option:
+:component-header: Only producer is supported
+//Manually maintained attributes
+:group: AI
+
+*Since Camel {since}*
+
+*{component-header}*
+
+The LangChain4j Service component invokes user-defined 
https://docs.langchain4j.dev/tutorials/ai-services[LangChain4j AI Services] 
from Camel routes. You define the AI Service interface, build it with the 
LangChain4j `AiServices` builder, and register it in the Camel registry. The 
component looks it up and invokes it. LangChain4j owns all AI behavior: 
prompts, memory, tools, guardrails, and agentic loops.
+
+The component does not create or configure AI Services. It performs registry 
lookup and method invocation only.
+
+Streaming responses, such as AI Service methods returning `TokenStream`, are 
not supported in this version. Methods must return a synchronous result.
+
+== Why not the bean component?
+
+The xref:bean-component.adoc[Bean] component can also invoke a registered 
object. This component adds AI-specific behavior on top:
+
+* Parameter binding follows LangChain4j annotations. The body binds to the 
`@UserMessage` parameter. Headers bind to `@V` template variables and the 
`@MemoryId` parameter.
+* Fail-fast validation at route startup. Missing services, ambiguous methods, 
and invalid method names fail before the first message flows.
+* A stable, component-scoped header namespace for AI concerns such as memory 
IDs and template variables.
+
+== URI format
+
+[source]
+----
+langchain4j-service:serviceName[?method=methodName]
+----
+
+Where *serviceName* is the name of the AI Service bean in the Camel registry.
+
+A `default` method counts as a method: it is callable, and a service built by 
a framework implements it as a concrete method, so there is no way to tell it 
apart. A `static` method is never a candidate.
+
+The `method` parameter is optional when the registered instance exposes a 
single method. It is required as soon as there are several, which is the normal 
case when a framework builds the service: the framework's own methods sit next 
to the AI Service ones. Method overloading is not supported: method names must 
be unique.
+
+// component options: START
+include::partial$component-configure-options.adoc[]
+include::partial$component-endpoint-options.adoc[]
+include::partial$component-endpoint-headers.adoc[]
+// component options: END
+
+== Parameter binding
+
+The producer binds AI Service method parameters from the exchange:
+
+[width="100%",cols="30%,70%",options="header"]
+|===
+| Parameter annotation | Bound from
+
+| `@UserMessage` | The message body, converted to the parameter type.
+| `@V("variableName")` | The `"variableName"` key of the 
`CamelLangChain4jServiceVariables` header, a `Map<String, Object>` of template 
variable name to value.
+| `@MemoryId` | The header `CamelLangChain4jServiceMemoryId`.
+| _none (single parameter)_ | The message body.
+|===
+
+Rules:
+
+* A method with multiple parameters must annotate every parameter with 
`@UserMessage`, `@V`, or `@MemoryId`.
+  This is stricter than LangChain4j on its own, which binds an un-annotated 
parameter as a template variable named
+  after the parameter. The component rejects that shape at route startup 
instead, because an unbound parameter in a
+  route is nearly always a mistake, and the parameter name is only available 
when the class was compiled with
+  `-parameters`.
+* At most one parameter can be annotated with `@UserMessage`.
+* Two parameters with the same `@V` variable name are rejected at route 
startup: they would silently feed from the same map key.
+* An empty `@V("")` template variable name is rejected at route startup.
+* At most one parameter can be annotated with `@MemoryId`.
+* The `CamelLangChain4jServiceVariables` and `CamelLangChain4jServiceMemoryId` 
headers are required at runtime when the method has `@V` or `@MemoryId` 
parameters. A missing header fails the exchange with an exception caused by 
`NoSuchHeaderException`, so `onException(NoSuchHeaderException.class)` matches 
it. A variables map that lacks a `@V` variable's key fails the exchange with an 
`IllegalArgumentException` naming the variable.
+* Zero-parameter methods are supported. Use a method-level 
`@UserMessage("...")` template. The message body is ignored.
+* A non-void method's return value becomes the new message body; a `null` 
return sets the body to `null`. A void method leaves the body unchanged.
+
+== Usage
+
+=== Single-method AI Service
+
+Define the interface, build the service, and register it:
+
+[source,java]
+----
+interface Assistant {
+    String chat(@UserMessage String text);
+}
+
+Assistant assistant = AiServices.builder(Assistant.class)
+        .chatModel(model)
+        .build();
+
+camelContext.getRegistry().bind("assistant", assistant);
+----
+
+Invoke it from a route:
+
+[source,java]
+----
+from("direct:chat")
+    .to("langchain4j-service:assistant");
+----
+
+The body is passed as the user message. The AI response becomes the new body.
+
+=== Multi-method AI Service
+
+When the interface has more than one method, select one with the `method` 
parameter:
+
+[source,java]
+----
+interface Assistant {
+    String chat(@UserMessage String text);
+    String summarize(@UserMessage String text);
+}
+
+from("direct:summarize")
+    .to("langchain4j-service:assistant?method=summarize");
+----
+
+Omitting `method` on a multi-method interface fails at route startup.
+
+=== Template variables
+
+LangChain4j prompt templates use `@V` variables. They bind from the 
`CamelLangChain4jServiceVariables` header, a map of variable name to value:
+
+[source,java]
+----
+interface Assistant {
+    @SystemMessage("Use the following context when answering: {{context}}")
+    String analyze(@UserMessage String text, @V("context") String context);
+}
+
+from("direct:analyze")
+    .setHeader(LangChain4jServiceHeaders.VARIABLES, constant(Map.of("context", 
"background info")))
+    .to("langchain4j-service:assistant");
+----
+
+=== Memory ID for stateful AI Services
+
+AI Services with chat memory take a `@MemoryId` parameter. It binds from the 
`CamelLangChain4jServiceMemoryId` header:
+
+[source,java]
+----
+interface Assistant {
+    String chat(@UserMessage String text, @MemoryId String memoryId);
+}
+
+Assistant assistant = AiServices.builder(Assistant.class)
+        .chatModel(model)
+        .chatMemoryProvider(memoryId -> 
MessageWindowChatMemory.withMaxMessages(10))
+        .build();
+
+from("direct:chat")
+    .setHeader("CamelLangChain4jServiceMemoryId", header("sessionId"))
+    .to("langchain4j-service:assistant");
+----
+
+Each distinct memory ID keeps its own conversation history.
+
+[IMPORTANT]

Review Comment:
   LangChain4j renders the `@UserMessage` argument as a prompt template, so a 
body containing `{{tone}}` is expanded (other arguments of the call too) and 
`{{x}}` fails the exchange. Could the security notes say so and recommend a 
method-level `@UserMessage("...{{it}}")` for untrusted input, with a test? 
(also design/langchain4j-service.adoc:249)
   
   _Generated with [Claude Code](https://claude.com/claude-code) on behalf of 
@JiriOndrusek_



##########
components/camel-ai/camel-langchain4j-service/src/main/docs/langchain4j-service-component.adoc:
##########
@@ -0,0 +1,280 @@
+= LangChain4j Service Component
+:doctitle: LangChain4j Service
+:shortname: langchain4j-service
+:artifactid: camel-langchain4j-service
+:description: Invoke LangChain4j AI Services and agents from Camel routes.
+:since: 4.24
+:supportlevel: Preview
+:tabs-sync-option:
+:component-header: Only producer is supported
+//Manually maintained attributes
+:group: AI
+
+*Since Camel {since}*
+
+*{component-header}*
+
+The LangChain4j Service component invokes user-defined 
https://docs.langchain4j.dev/tutorials/ai-services[LangChain4j AI Services] 
from Camel routes. You define the AI Service interface, build it with the 
LangChain4j `AiServices` builder, and register it in the Camel registry. The 
component looks it up and invokes it. LangChain4j owns all AI behavior: 
prompts, memory, tools, guardrails, and agentic loops.
+
+The component does not create or configure AI Services. It performs registry 
lookup and method invocation only.
+
+Streaming responses, such as AI Service methods returning `TokenStream`, are 
not supported in this version. Methods must return a synchronous result.
+
+== Why not the bean component?
+
+The xref:bean-component.adoc[Bean] component can also invoke a registered 
object. This component adds AI-specific behavior on top:
+
+* Parameter binding follows LangChain4j annotations. The body binds to the 
`@UserMessage` parameter. Headers bind to `@V` template variables and the 
`@MemoryId` parameter.
+* Fail-fast validation at route startup. Missing services, ambiguous methods, 
and invalid method names fail before the first message flows.
+* A stable, component-scoped header namespace for AI concerns such as memory 
IDs and template variables.
+
+== URI format
+
+[source]
+----
+langchain4j-service:serviceName[?method=methodName]
+----
+
+Where *serviceName* is the name of the AI Service bean in the Camel registry.
+
+A `default` method counts as a method: it is callable, and a service built by 
a framework implements it as a concrete method, so there is no way to tell it 
apart. A `static` method is never a candidate.
+
+The `method` parameter is optional when the registered instance exposes a 
single method. It is required as soon as there are several, which is the normal 
case when a framework builds the service: the framework's own methods sit next 
to the AI Service ones. Method overloading is not supported: method names must 
be unique.
+
+// component options: START
+include::partial$component-configure-options.adoc[]
+include::partial$component-endpoint-options.adoc[]
+include::partial$component-endpoint-headers.adoc[]
+// component options: END
+
+== Parameter binding
+
+The producer binds AI Service method parameters from the exchange:
+
+[width="100%",cols="30%,70%",options="header"]
+|===
+| Parameter annotation | Bound from
+
+| `@UserMessage` | The message body, converted to the parameter type.
+| `@V("variableName")` | The `"variableName"` key of the 
`CamelLangChain4jServiceVariables` header, a `Map<String, Object>` of template 
variable name to value.
+| `@MemoryId` | The header `CamelLangChain4jServiceMemoryId`.
+| _none (single parameter)_ | The message body.
+|===
+
+Rules:
+
+* A method with multiple parameters must annotate every parameter with 
`@UserMessage`, `@V`, or `@MemoryId`.
+  This is stricter than LangChain4j on its own, which binds an un-annotated 
parameter as a template variable named
+  after the parameter. The component rejects that shape at route startup 
instead, because an unbound parameter in a
+  route is nearly always a mistake, and the parameter name is only available 
when the class was compiled with
+  `-parameters`.
+* At most one parameter can be annotated with `@UserMessage`.
+* Two parameters with the same `@V` variable name are rejected at route 
startup: they would silently feed from the same map key.
+* An empty `@V("")` template variable name is rejected at route startup.
+* At most one parameter can be annotated with `@MemoryId`.
+* The `CamelLangChain4jServiceVariables` and `CamelLangChain4jServiceMemoryId` 
headers are required at runtime when the method has `@V` or `@MemoryId` 
parameters. A missing header fails the exchange with an exception caused by 
`NoSuchHeaderException`, so `onException(NoSuchHeaderException.class)` matches 
it. A variables map that lacks a `@V` variable's key fails the exchange with an 
`IllegalArgumentException` naming the variable.
+* Zero-parameter methods are supported. Use a method-level 
`@UserMessage("...")` template. The message body is ignored.
+* A non-void method's return value becomes the new message body; a `null` 
return sets the body to `null`. A void method leaves the body unchanged.
+
+== Usage
+
+=== Single-method AI Service
+
+Define the interface, build the service, and register it:
+
+[source,java]
+----
+interface Assistant {
+    String chat(@UserMessage String text);
+}
+
+Assistant assistant = AiServices.builder(Assistant.class)
+        .chatModel(model)
+        .build();
+
+camelContext.getRegistry().bind("assistant", assistant);
+----
+
+Invoke it from a route:
+
+[source,java]
+----
+from("direct:chat")
+    .to("langchain4j-service:assistant");
+----
+
+The body is passed as the user message. The AI response becomes the new body.
+
+=== Multi-method AI Service
+
+When the interface has more than one method, select one with the `method` 
parameter:
+
+[source,java]
+----
+interface Assistant {
+    String chat(@UserMessage String text);
+    String summarize(@UserMessage String text);
+}
+
+from("direct:summarize")
+    .to("langchain4j-service:assistant?method=summarize");
+----
+
+Omitting `method` on a multi-method interface fails at route startup.
+
+=== Template variables
+
+LangChain4j prompt templates use `@V` variables. They bind from the 
`CamelLangChain4jServiceVariables` header, a map of variable name to value:
+
+[source,java]
+----
+interface Assistant {
+    @SystemMessage("Use the following context when answering: {{context}}")
+    String analyze(@UserMessage String text, @V("context") String context);
+}
+
+from("direct:analyze")
+    .setHeader(LangChain4jServiceHeaders.VARIABLES, constant(Map.of("context", 
"background info")))
+    .to("langchain4j-service:assistant");
+----
+
+=== Memory ID for stateful AI Services
+
+AI Services with chat memory take a `@MemoryId` parameter. It binds from the 
`CamelLangChain4jServiceMemoryId` header:
+
+[source,java]
+----
+interface Assistant {
+    String chat(@UserMessage String text, @MemoryId String memoryId);
+}
+
+Assistant assistant = AiServices.builder(Assistant.class)
+        .chatModel(model)
+        .chatMemoryProvider(memoryId -> 
MessageWindowChatMemory.withMaxMessages(10))
+        .build();
+
+from("direct:chat")
+    .setHeader("CamelLangChain4jServiceMemoryId", header("sessionId"))
+    .to("langchain4j-service:assistant");
+----
+
+Each distinct memory ID keeps its own conversation history.
+
+[IMPORTANT]
+====
+The memory ID comes from a header. A sender that controls headers therefore 
selects which conversation
+history the AI Service reads and appends to. When a consumer maps untrusted 
input into headers, strip the
+component headers before the `to`, for example with 
`removeHeaders("CamelLangChain4jService*")`, and set the
+memory ID from a value the route trusts.
+====
+
+=== Tool-enabled AI Services
+
+A tool-enabled interface is invoked like any other. LangChain4j runs the 
tool-calling loop inside the invocation, and the final result is returned to 
the route:
+
+[source,java]
+----
+Assistant assistant = AiServices.builder(Assistant.class)
+        .chatModel(model)
+        .tools(new WeatherTools())
+        .build();
+
+from("direct:assistant")
+    .to("langchain4j-service:assistant");
+----
+
+=== Agents and agentic workflows
+
+WARNING: Agent support is experimental. LangChain4j publishes its agentic 
module as a `-betaNN` artifact whose API still changes between releases, so how 
agents bind to routes may change with it.
+
+A LangChain4j agent is an interface with one method annotated `@Agent`, built 
with `AgenticServices`. The component invokes it like any other AI Service. 
Agent method parameters are annotated `@V`, so they bind from the 
`CamelLangChain4jServiceVariables` map header.
+
+Agents live in the LangChain4j agentic module, which this component does not 
bring in. Add it to your project:
+
+[source,xml]
+----
+<dependency>
+    <groupId>dev.langchain4j</groupId>
+    <artifactId>langchain4j-agentic</artifactId>
+    <version>${langchain4j-beta-version}</version>
+</dependency>
+----
+
+The agentic module is still published under a `-betaNN` suffix, so its version 
is not the plain LangChain4j version. Camel builds against it under the 
`langchain4j-beta-version` property. Pick the suffixed version matching the 
LangChain4j version this Camel release builds against.
+
+[source,java]
+----
+public interface StoryWriterAgent {
+    @Agent(value = "Writes a one-sentence story about a topic", outputKey = 
"story")
+    @UserMessage("Write a one-sentence story about {{topic}}.")
+    String writeStory(@V("topic") String topic);
+}
+
+StoryWriterAgent agent = AgenticServices.agentBuilder(StoryWriterAgent.class)
+        .chatModel(model)
+        .build();
+
+camelContext.getRegistry().bind("storyWriter", agent);
+
+from("direct:story")
+    .setHeader(LangChain4jServiceHeaders.VARIABLES, constant(Map.of("topic", 
"a camel crossing the desert")))
+    .to("langchain4j-service:storyWriter?method=writeStory");
+----
+
+An agentic workflow, such as a sequence, a parallel, a loop, a conditional, a 
supervisor or a planner, is itself an agent, so it is invoked the same way. 
Every workflow kind is built the same way, so they all behave alike here. The 
whole workflow runs inside the single invocation, and the value of its output 
key becomes the message body:
+
+[source,java]
+----
+public interface StoryFlowAgent {
+    @Agent
+    String writeLoudStory(@V("topic") String topic);
+}
+
+StoryFlowAgent flow = AgenticServices.sequenceBuilder(StoryFlowAgent.class)
+        .subAgents(writer, rewriter)
+        .outputKey("loudStory")
+        .build();
+
+camelContext.getRegistry().bind("storyFlow", flow);
+
+from("direct:story")
+    .setHeader(LangChain4jServiceHeaders.VARIABLES, constant(Map.of("topic", 
"a camel crossing the desert")))
+    .to("langchain4j-service:storyFlow?method=writeLoudStory");
+----
+
+`AgenticServices` builds its services over the agent interface plus its own 
framework interfaces, such as `InternalAgent` and `AgenticScopeOwner`. Their 
methods sit next to the agent method, so set `method` to the name of the agent 
method.
+
+Untyped agents are not supported in this version. The no-argument builders 
return a LangChain4j interface instead of a user interface: `UntypedAgent` for 
`agentBuilder()`, `sequenceBuilder()` and the other workflow builders, 
`SupervisorAgent` for `supervisorBuilder()`. Those carry no LangChain4j 
parameter annotations, so there is nothing to bind the body and headers to. Use 
the typed builders, which take the agent interface as an argument.

Review Comment:
   `UntypedAgent.invoke` takes `@V("input")` and `SupervisorAgent.invoke` takes 
`@V("request")`, so both run with `method=invoke` and the Variables header. 
Document that, or reject them at startup by type?
   
   _Generated with [Claude Code](https://claude.com/claude-code) on behalf of 
@JiriOndrusek_



##########
components/camel-ai/camel-langchain4j-service/src/main/docs/langchain4j-service-component.adoc:
##########
@@ -0,0 +1,280 @@
+= LangChain4j Service Component
+:doctitle: LangChain4j Service
+:shortname: langchain4j-service
+:artifactid: camel-langchain4j-service
+:description: Invoke LangChain4j AI Services and agents from Camel routes.
+:since: 4.24
+:supportlevel: Preview
+:tabs-sync-option:
+:component-header: Only producer is supported
+//Manually maintained attributes
+:group: AI
+
+*Since Camel {since}*
+
+*{component-header}*
+
+The LangChain4j Service component invokes user-defined 
https://docs.langchain4j.dev/tutorials/ai-services[LangChain4j AI Services] 
from Camel routes. You define the AI Service interface, build it with the 
LangChain4j `AiServices` builder, and register it in the Camel registry. The 
component looks it up and invokes it. LangChain4j owns all AI behavior: 
prompts, memory, tools, guardrails, and agentic loops.
+
+The component does not create or configure AI Services. It performs registry 
lookup and method invocation only.
+
+Streaming responses, such as AI Service methods returning `TokenStream`, are 
not supported in this version. Methods must return a synchronous result.
+
+== Why not the bean component?
+
+The xref:bean-component.adoc[Bean] component can also invoke a registered 
object. This component adds AI-specific behavior on top:
+
+* Parameter binding follows LangChain4j annotations. The body binds to the 
`@UserMessage` parameter. Headers bind to `@V` template variables and the 
`@MemoryId` parameter.
+* Fail-fast validation at route startup. Missing services, ambiguous methods, 
and invalid method names fail before the first message flows.
+* A stable, component-scoped header namespace for AI concerns such as memory 
IDs and template variables.
+
+== URI format
+
+[source]
+----
+langchain4j-service:serviceName[?method=methodName]
+----
+
+Where *serviceName* is the name of the AI Service bean in the Camel registry.
+
+A `default` method counts as a method: it is callable, and a service built by 
a framework implements it as a concrete method, so there is no way to tell it 
apart. A `static` method is never a candidate.
+
+The `method` parameter is optional when the registered instance exposes a 
single method. It is required as soon as there are several, which is the normal 
case when a framework builds the service: the framework's own methods sit next 
to the AI Service ones. Method overloading is not supported: method names must 
be unique.
+
+// component options: START
+include::partial$component-configure-options.adoc[]
+include::partial$component-endpoint-options.adoc[]
+include::partial$component-endpoint-headers.adoc[]
+// component options: END
+
+== Parameter binding
+
+The producer binds AI Service method parameters from the exchange:
+
+[width="100%",cols="30%,70%",options="header"]
+|===
+| Parameter annotation | Bound from
+
+| `@UserMessage` | The message body, converted to the parameter type.
+| `@V("variableName")` | The `"variableName"` key of the 
`CamelLangChain4jServiceVariables` header, a `Map<String, Object>` of template 
variable name to value.
+| `@MemoryId` | The header `CamelLangChain4jServiceMemoryId`.
+| _none (single parameter)_ | The message body.
+|===
+
+Rules:
+
+* A method with multiple parameters must annotate every parameter with 
`@UserMessage`, `@V`, or `@MemoryId`.
+  This is stricter than LangChain4j on its own, which binds an un-annotated 
parameter as a template variable named
+  after the parameter. The component rejects that shape at route startup 
instead, because an unbound parameter in a
+  route is nearly always a mistake, and the parameter name is only available 
when the class was compiled with
+  `-parameters`.
+* At most one parameter can be annotated with `@UserMessage`.
+* Two parameters with the same `@V` variable name are rejected at route 
startup: they would silently feed from the same map key.
+* An empty `@V("")` template variable name is rejected at route startup.
+* At most one parameter can be annotated with `@MemoryId`.
+* The `CamelLangChain4jServiceVariables` and `CamelLangChain4jServiceMemoryId` 
headers are required at runtime when the method has `@V` or `@MemoryId` 
parameters. A missing header fails the exchange with an exception caused by 
`NoSuchHeaderException`, so `onException(NoSuchHeaderException.class)` matches 
it. A variables map that lacks a `@V` variable's key fails the exchange with an 
`IllegalArgumentException` naming the variable.
+* Zero-parameter methods are supported. Use a method-level 
`@UserMessage("...")` template. The message body is ignored.
+* A non-void method's return value becomes the new message body; a `null` 
return sets the body to `null`. A void method leaves the body unchanged.
+
+== Usage
+
+=== Single-method AI Service
+
+Define the interface, build the service, and register it:
+
+[source,java]
+----
+interface Assistant {
+    String chat(@UserMessage String text);
+}
+
+Assistant assistant = AiServices.builder(Assistant.class)
+        .chatModel(model)
+        .build();
+
+camelContext.getRegistry().bind("assistant", assistant);
+----
+
+Invoke it from a route:
+
+[source,java]
+----
+from("direct:chat")
+    .to("langchain4j-service:assistant");
+----
+
+The body is passed as the user message. The AI response becomes the new body.
+
+=== Multi-method AI Service
+
+When the interface has more than one method, select one with the `method` 
parameter:
+
+[source,java]
+----
+interface Assistant {
+    String chat(@UserMessage String text);
+    String summarize(@UserMessage String text);
+}
+
+from("direct:summarize")
+    .to("langchain4j-service:assistant?method=summarize");
+----
+
+Omitting `method` on a multi-method interface fails at route startup.
+
+=== Template variables
+
+LangChain4j prompt templates use `@V` variables. They bind from the 
`CamelLangChain4jServiceVariables` header, a map of variable name to value:
+
+[source,java]
+----
+interface Assistant {
+    @SystemMessage("Use the following context when answering: {{context}}")
+    String analyze(@UserMessage String text, @V("context") String context);
+}
+
+from("direct:analyze")
+    .setHeader(LangChain4jServiceHeaders.VARIABLES, constant(Map.of("context", 
"background info")))
+    .to("langchain4j-service:assistant");
+----
+
+=== Memory ID for stateful AI Services
+
+AI Services with chat memory take a `@MemoryId` parameter. It binds from the 
`CamelLangChain4jServiceMemoryId` header:
+
+[source,java]
+----
+interface Assistant {
+    String chat(@UserMessage String text, @MemoryId String memoryId);
+}
+
+Assistant assistant = AiServices.builder(Assistant.class)
+        .chatModel(model)
+        .chatMemoryProvider(memoryId -> 
MessageWindowChatMemory.withMaxMessages(10))
+        .build();
+
+from("direct:chat")
+    .setHeader("CamelLangChain4jServiceMemoryId", header("sessionId"))

Review Comment:
   The example takes the memory id from an inbound `sessionId` header, which 
the box below warns against. Maybe derive it from the authenticated principal?
   
   _Generated with [Claude Code](https://claude.com/claude-code) on behalf of 
@JiriOndrusek_



##########
components/camel-ai/camel-langchain4j-service/src/main/java/org/apache/camel/component/langchain4j/service/LangChain4jServiceEndpoint.java:
##########
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.langchain4j.service;
+
+import org.apache.camel.Category;
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
+import org.apache.camel.support.DefaultEndpoint;
+
+import static 
org.apache.camel.component.langchain4j.service.LangChain4jService.SCHEME;
+
+/**
+ * Invoke LangChain4j AI Services and agents from Camel routes.
+ */
+@UriEndpoint(firstVersion = "4.24.0", scheme = SCHEME,
+             title = "LangChain4j Service",
+             syntax = "langchain4j-service:serviceName",
+             producerOnly = true,
+             category = { Category.AI }, headersClass = 
LangChain4jServiceHeaders.class)

Review Comment:
   All other camel-ai endpoints declare `@BodyTypes`. Could this one too, so 
the catalog shows what goes in and comes out of the body?
   
   _Generated with [Claude Code](https://claude.com/claude-code) on behalf of 
@JiriOndrusek_



##########
components/camel-ai/camel-langchain4j-service/src/main/docs/langchain4j-service-component.adoc:
##########
@@ -0,0 +1,280 @@
+= LangChain4j Service Component
+:doctitle: LangChain4j Service
+:shortname: langchain4j-service
+:artifactid: camel-langchain4j-service
+:description: Invoke LangChain4j AI Services and agents from Camel routes.
+:since: 4.24
+:supportlevel: Preview
+:tabs-sync-option:
+:component-header: Only producer is supported
+//Manually maintained attributes
+:group: AI
+
+*Since Camel {since}*
+
+*{component-header}*
+
+The LangChain4j Service component invokes user-defined 
https://docs.langchain4j.dev/tutorials/ai-services[LangChain4j AI Services] 
from Camel routes. You define the AI Service interface, build it with the 
LangChain4j `AiServices` builder, and register it in the Camel registry. The 
component looks it up and invokes it. LangChain4j owns all AI behavior: 
prompts, memory, tools, guardrails, and agentic loops.
+
+The component does not create or configure AI Services. It performs registry 
lookup and method invocation only.
+
+Streaming responses, such as AI Service methods returning `TokenStream`, are 
not supported in this version. Methods must return a synchronous result.
+
+== Why not the bean component?
+
+The xref:bean-component.adoc[Bean] component can also invoke a registered 
object. This component adds AI-specific behavior on top:
+
+* Parameter binding follows LangChain4j annotations. The body binds to the 
`@UserMessage` parameter. Headers bind to `@V` template variables and the 
`@MemoryId` parameter.
+* Fail-fast validation at route startup. Missing services, ambiguous methods, 
and invalid method names fail before the first message flows.
+* A stable, component-scoped header namespace for AI concerns such as memory 
IDs and template variables.
+
+== URI format
+
+[source]
+----
+langchain4j-service:serviceName[?method=methodName]
+----
+
+Where *serviceName* is the name of the AI Service bean in the Camel registry.
+
+A `default` method counts as a method: it is callable, and a service built by 
a framework implements it as a concrete method, so there is no way to tell it 
apart. A `static` method is never a candidate.
+
+The `method` parameter is optional when the registered instance exposes a 
single method. It is required as soon as there are several, which is the normal 
case when a framework builds the service: the framework's own methods sit next 
to the AI Service ones. Method overloading is not supported: method names must 
be unique.
+
+// component options: START
+include::partial$component-configure-options.adoc[]
+include::partial$component-endpoint-options.adoc[]
+include::partial$component-endpoint-headers.adoc[]
+// component options: END
+
+== Parameter binding
+
+The producer binds AI Service method parameters from the exchange:
+
+[width="100%",cols="30%,70%",options="header"]
+|===
+| Parameter annotation | Bound from
+
+| `@UserMessage` | The message body, converted to the parameter type.
+| `@V("variableName")` | The `"variableName"` key of the 
`CamelLangChain4jServiceVariables` header, a `Map<String, Object>` of template 
variable name to value.
+| `@MemoryId` | The header `CamelLangChain4jServiceMemoryId`.

Review Comment:
   Doc nit: `CamelLangChain4jServiceMemoryId` only binds to a `@MemoryId` 
parameter. On a service built with a single `chatMemory(...)` and no 
`@MemoryId` it has no effect and all exchanges share one conversation, same as 
calling the AI Service directly (verified with a stub model). Could the Memory 
section say that per-id isolation needs `@MemoryId` plus 
`chatMemoryProvider(...)`?
   
   _Generated with [Claude Code](https://claude.com/claude-code) on behalf of 
@JiriOndrusek_



##########
components/camel-ai/camel-langchain4j-service/src/main/java/org/apache/camel/component/langchain4j/service/LangChain4jServiceProducer.java:
##########
@@ -0,0 +1,540 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.langchain4j.service;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Parameter;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import dev.langchain4j.service.MemoryId;
+import dev.langchain4j.service.TokenStream;
+import dev.langchain4j.service.UserMessage;
+import dev.langchain4j.service.V;
+import org.apache.camel.Exchange;
+import org.apache.camel.NoSuchBeanException;
+import org.apache.camel.NoSuchHeaderException;
+import org.apache.camel.component.bean.BeanInfo;
+import org.apache.camel.component.bean.MethodInfo;
+import org.apache.camel.support.DefaultProducer;
+import org.apache.camel.support.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Producer that invokes LangChain4j AI Service methods with parameter binding 
from Camel exchanges.
+ * <p>
+ * Method resolution is delegated to Camel's bean binding ({@link BeanInfo}), 
which pools the methods of the service
+ * instance and of every interface it implements, and collects each 
parameter's annotations from wherever they are
+ * declared. The producer then binds the parameters from the exchange body and 
headers according to the LangChain4j
+ * annotations:
+ * <ul>
+ * <li>{@code @UserMessage} - binds from exchange body</li>
+ * <li>{@code @V("variableName")} - binds from the {@code "variableName"} key 
of the
+ * {@code CamelLangChain4jServiceVariables} map header</li>
+ * <li>{@code @MemoryId} - binds from header {@code 
CamelLangChain4jServiceMemoryId}</li>
+ * </ul>
+ * <p>
+ * The AI Service is looked up in the registry and its target method resolved 
when the producer starts, so
+ * {@code lazyStartProducer=true} defers both the resolution and its failures 
to the first message. Parameter binding
+ * strategies are computed once at the same time for thread-safe, efficient 
invocation, and every start recomputes them,
+ * so a restarted producer picks up a service that was rebound in the registry 
meanwhile.
+ */
+public class LangChain4jServiceProducer extends DefaultProducer {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(LangChain4jServiceProducer.class);
+
+    private Object serviceInstance;
+    private MethodInfo targetMethodInfo;
+    private Method targetMethod;
+    private List<ParameterBinding> parameterBindings;
+
+    /**
+     * Creates a new producer.
+     *
+     * @param endpoint the endpoint
+     */
+    public LangChain4jServiceProducer(LangChain4jServiceEndpoint endpoint) {
+        super(endpoint);
+    }
+
+    @Override
+    public LangChain4jServiceEndpoint getEndpoint() {
+        return (LangChain4jServiceEndpoint) super.getEndpoint();
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+
+        // Resolve on producer start (not endpoint init) so lazyStartProducer 
can defer failures
+        serviceInstance = lookupServiceInstance();
+        targetMethodInfo = resolveTargetMethod();
+        targetMethod = targetMethodInfo.getMethod();
+        validateReturnType();
+        parameterBindings = computeParameterBindings();
+
+        LOG.debug("Started producer for AI Service '{}' method '{}' with {} 
parameter bindings",
+                getEndpoint().getServiceName(), targetMethod.getName(), 
parameterBindings.size());
+    }
+
+    /**
+     * Looks up the AI Service instance in the Camel registry.
+     *
+     * @return                     the AI Service instance
+     * @throws NoSuchBeanException if no bean is registered under the 
configured service name
+     */
+    private Object lookupServiceInstance() {
+        String serviceName = getEndpoint().getServiceName();
+        Object instance = 
getEndpoint().getCamelContext().getRegistry().lookupByName(serviceName);
+        if (instance == null) {
+            throw new NoSuchBeanException(serviceName);
+        }
+        return instance;
+    }
+
+    /**
+     * Resolves the method to invoke on the AI Service.
+     * <p>
+     * The introspection is delegated to Camel's bean binding, so the method 
is found whatever shape the registered
+     * instance has, and each parameter carries the annotations declared on 
the AI Service interface.
+     *
+     * @return                          the resolved method
+     * @throws IllegalArgumentException if method resolution fails
+     */
+    private MethodInfo resolveTargetMethod() {
+        String serviceName = getEndpoint().getServiceName();
+        BeanInfo beanInfo = new BeanInfo(getEndpoint().getCamelContext(), 
serviceInstance.getClass());
+
+        List<MethodInfo> businessMethods = beanInfo.getMethods().stream()
+                .filter(this::isBusinessMethod)
+                .collect(Collectors.toList());
+
+        if (businessMethods.isEmpty()) {
+            throw new IllegalArgumentException(
+                    "AI Service '" + serviceName + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                               + ") has no method to invoke");
+        }
+
+        String methodName = getEndpoint().getConfiguration().getMethod();
+
+        if (businessMethods.size() == 1) {
+            MethodInfo single = businessMethods.get(0);
+            // An explicitly configured method name must still match (never 
ignore it silently)
+            if (methodName != null && !methodName.isEmpty() && 
!single.getMethod().getName().equals(methodName)) {
+                throw new IllegalArgumentException(
+                        "Method '" + methodName + "' not found on AI Service 
'" + serviceName
+                                                   + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                                   + "). Available methods: " 
+ single.getMethod().getName());
+            }
+            return single;
+        }
+
+        // Multiple methods: require an explicit method parameter. A service 
instance built by a framework exposes the
+        // framework's own methods next to the AI Service ones, so this is the 
normal case outside plain Java
+        if (methodName == null || methodName.isEmpty()) {
+            throw new IllegalArgumentException(
+                    "AI Service '" + serviceName + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                               + ") has multiple methods. 
Specify method parameter. Available methods: "
+                                               + 
listMethodNames(businessMethods));
+        }
+
+        List<MethodInfo> matchingMethods = businessMethods.stream()
+                .filter(info -> info.getMethod().getName().equals(methodName))
+                .collect(Collectors.toList());
+
+        if (matchingMethods.isEmpty()) {
+            throw new IllegalArgumentException(
+                    "Method '" + methodName + "' not found on AI Service '" + 
serviceName
+                                               + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                               + "). Available methods: " + 
listMethodNames(businessMethods));
+        }
+
+        if (matchingMethods.size() > 1) {
+            throw new IllegalArgumentException(
+                    "AI Service '" + serviceName + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                               + ") has multiple methods named 
'" + methodName
+                                               + "'. Method overloading is not 
supported: method names must be unique.");
+        }
+
+        return matchingMethods.get(0);
+    }
+
+    /**
+     * Checks if a method is a business method (abstract instance method, not 
default, static, or Object method).
+     *
+     * @param  info the method to check, as Camel's bean binding describes it
+     * @return      true if the method is a business method
+     */
+    private boolean isBusinessMethod(MethodInfo info) {
+        // A static method is never invoked on the instance. A default method, 
on the other hand, is a candidate like
+        // any other: it is callable, and a service built by a framework 
implements it as a concrete method anyway, so
+        // there would be no way to tell it apart
+        if (info.isStaticMethod()) {
+            return false;
+        }
+
+        // Camel's bean binding already discards equals, hashCode and the 
other java.lang.Object and java.lang.Proxy
+        // method names, but not toString
+        Method method = info.getMethod();
+        return !(method.getName().equals("toString") && 
method.getParameterCount() == 0);
+    }
+
+    /**
+     * Rejects a return type the producer cannot deliver to the route.
+     * <p>
+     * A method returning {@link TokenStream} hands back a stream nobody 
subscribes to: the producer would set it as the
+     * message body, the route would carry an object that never emits, and the 
caller would see neither an answer nor an
+     * error. The return type is known when the producer starts, so this fails 
there rather than silently at runtime.
+     *
+     * @throws IllegalArgumentException if the method returns a streaming type
+     */
+    private void validateReturnType() {
+        if (TokenStream.class.isAssignableFrom(targetMethod.getReturnType())) {

Review Comment:
   `Flow.Publisher` and Flux also start fine here (the body becomes an 
unsubscribed stream). With a future, a failed model call only shows up later as 
a type-conversion error when something reads the body.
   
   _Generated with [Claude Code](https://claude.com/claude-code) on behalf of 
@JiriOndrusek_



##########
components/camel-bean/src/main/java/org/apache/camel/component/bean/MethodInfo.java:
##########
@@ -466,6 +466,29 @@ public List<ParameterInfo> getParameters() {
         return parameters;
     }
 
+    /**
+     * The annotations of each parameter, in declaration order.
+     * <p/>
+     * Same shape as {@link Method#getParameterAnnotations()}, except that an 
annotation declared on the method of an
+     * interface or of a superclass is found as well, which {@link Method} 
does not do. This is what makes the
+     * annotations of a bean reachable when the registered instance is a class 
generated by a framework and the
+     * annotations sit on the interface it implements.
+     * <p/>
+     * The one-to-one mapping with the method's declared parameters holds for 
the {@link MethodInfo} that
+     * {@link BeanInfo} builds, which keeps every declared parameter, in 
order. A {@link MethodInfo} constructed
+     * directly with a filtered parameter list does not line up with {@link 
Method#getParameters()}.
+     *
+     * @return one array of annotations per parameter, empty when the method 
takes no parameter
+     * @since  4.24
+     */
+    public Annotation[][] getParameterAnnotations() {

Review Comment:
   The arrays belong to the `MethodInfo` that `BeanInfo` caches and shares with 
every bean user: after a caller mutates one, a new `BeanInfo` of the same class 
returns the mutated value (reproduced). It can also return a null row.
   
   _Generated with [Claude Code](https://claude.com/claude-code) on behalf of 
@JiriOndrusek_



##########
components/camel-ai/camel-langchain4j-service/src/main/java/org/apache/camel/component/langchain4j/service/LangChain4jServiceProducer.java:
##########
@@ -0,0 +1,540 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.langchain4j.service;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Parameter;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import dev.langchain4j.service.MemoryId;
+import dev.langchain4j.service.TokenStream;
+import dev.langchain4j.service.UserMessage;
+import dev.langchain4j.service.V;
+import org.apache.camel.Exchange;
+import org.apache.camel.NoSuchBeanException;
+import org.apache.camel.NoSuchHeaderException;
+import org.apache.camel.component.bean.BeanInfo;
+import org.apache.camel.component.bean.MethodInfo;
+import org.apache.camel.support.DefaultProducer;
+import org.apache.camel.support.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Producer that invokes LangChain4j AI Service methods with parameter binding 
from Camel exchanges.
+ * <p>
+ * Method resolution is delegated to Camel's bean binding ({@link BeanInfo}), 
which pools the methods of the service
+ * instance and of every interface it implements, and collects each 
parameter's annotations from wherever they are
+ * declared. The producer then binds the parameters from the exchange body and 
headers according to the LangChain4j
+ * annotations:
+ * <ul>
+ * <li>{@code @UserMessage} - binds from exchange body</li>
+ * <li>{@code @V("variableName")} - binds from the {@code "variableName"} key 
of the
+ * {@code CamelLangChain4jServiceVariables} map header</li>
+ * <li>{@code @MemoryId} - binds from header {@code 
CamelLangChain4jServiceMemoryId}</li>
+ * </ul>
+ * <p>
+ * The AI Service is looked up in the registry and its target method resolved 
when the producer starts, so
+ * {@code lazyStartProducer=true} defers both the resolution and its failures 
to the first message. Parameter binding
+ * strategies are computed once at the same time for thread-safe, efficient 
invocation, and every start recomputes them,
+ * so a restarted producer picks up a service that was rebound in the registry 
meanwhile.
+ */
+public class LangChain4jServiceProducer extends DefaultProducer {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(LangChain4jServiceProducer.class);
+
+    private Object serviceInstance;
+    private MethodInfo targetMethodInfo;
+    private Method targetMethod;
+    private List<ParameterBinding> parameterBindings;
+
+    /**
+     * Creates a new producer.
+     *
+     * @param endpoint the endpoint
+     */
+    public LangChain4jServiceProducer(LangChain4jServiceEndpoint endpoint) {
+        super(endpoint);
+    }
+
+    @Override
+    public LangChain4jServiceEndpoint getEndpoint() {
+        return (LangChain4jServiceEndpoint) super.getEndpoint();
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+
+        // Resolve on producer start (not endpoint init) so lazyStartProducer 
can defer failures
+        serviceInstance = lookupServiceInstance();
+        targetMethodInfo = resolveTargetMethod();
+        targetMethod = targetMethodInfo.getMethod();
+        validateReturnType();
+        parameterBindings = computeParameterBindings();
+
+        LOG.debug("Started producer for AI Service '{}' method '{}' with {} 
parameter bindings",
+                getEndpoint().getServiceName(), targetMethod.getName(), 
parameterBindings.size());
+    }
+
+    /**
+     * Looks up the AI Service instance in the Camel registry.
+     *
+     * @return                     the AI Service instance
+     * @throws NoSuchBeanException if no bean is registered under the 
configured service name
+     */
+    private Object lookupServiceInstance() {
+        String serviceName = getEndpoint().getServiceName();
+        Object instance = 
getEndpoint().getCamelContext().getRegistry().lookupByName(serviceName);
+        if (instance == null) {
+            throw new NoSuchBeanException(serviceName);
+        }
+        return instance;
+    }
+
+    /**
+     * Resolves the method to invoke on the AI Service.
+     * <p>
+     * The introspection is delegated to Camel's bean binding, so the method 
is found whatever shape the registered
+     * instance has, and each parameter carries the annotations declared on 
the AI Service interface.
+     *
+     * @return                          the resolved method
+     * @throws IllegalArgumentException if method resolution fails
+     */
+    private MethodInfo resolveTargetMethod() {
+        String serviceName = getEndpoint().getServiceName();
+        BeanInfo beanInfo = new BeanInfo(getEndpoint().getCamelContext(), 
serviceInstance.getClass());
+
+        List<MethodInfo> businessMethods = beanInfo.getMethods().stream()
+                .filter(this::isBusinessMethod)
+                .collect(Collectors.toList());
+
+        if (businessMethods.isEmpty()) {
+            throw new IllegalArgumentException(
+                    "AI Service '" + serviceName + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                               + ") has no method to invoke");
+        }
+
+        String methodName = getEndpoint().getConfiguration().getMethod();
+
+        if (businessMethods.size() == 1) {
+            MethodInfo single = businessMethods.get(0);
+            // An explicitly configured method name must still match (never 
ignore it silently)
+            if (methodName != null && !methodName.isEmpty() && 
!single.getMethod().getName().equals(methodName)) {
+                throw new IllegalArgumentException(
+                        "Method '" + methodName + "' not found on AI Service 
'" + serviceName
+                                                   + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                                   + "). Available methods: " 
+ single.getMethod().getName());
+            }
+            return single;
+        }
+
+        // Multiple methods: require an explicit method parameter. A service 
instance built by a framework exposes the
+        // framework's own methods next to the AI Service ones, so this is the 
normal case outside plain Java
+        if (methodName == null || methodName.isEmpty()) {
+            throw new IllegalArgumentException(
+                    "AI Service '" + serviceName + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                               + ") has multiple methods. 
Specify method parameter. Available methods: "
+                                               + 
listMethodNames(businessMethods));
+        }
+
+        List<MethodInfo> matchingMethods = businessMethods.stream()
+                .filter(info -> info.getMethod().getName().equals(methodName))
+                .collect(Collectors.toList());
+
+        if (matchingMethods.isEmpty()) {
+            throw new IllegalArgumentException(
+                    "Method '" + methodName + "' not found on AI Service '" + 
serviceName
+                                               + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                               + "). Available methods: " + 
listMethodNames(businessMethods));
+        }
+
+        if (matchingMethods.size() > 1) {
+            throw new IllegalArgumentException(
+                    "AI Service '" + serviceName + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                               + ") has multiple methods named 
'" + methodName
+                                               + "'. Method overloading is not 
supported: method names must be unique.");
+        }
+
+        return matchingMethods.get(0);
+    }
+
+    /**
+     * Checks if a method is a business method (abstract instance method, not 
default, static, or Object method).
+     *
+     * @param  info the method to check, as Camel's bean binding describes it
+     * @return      true if the method is a business method
+     */
+    private boolean isBusinessMethod(MethodInfo info) {
+        // A static method is never invoked on the instance. A default method, 
on the other hand, is a candidate like
+        // any other: it is callable, and a service built by a framework 
implements it as a concrete method anyway, so
+        // there would be no way to tell it apart
+        if (info.isStaticMethod()) {
+            return false;
+        }
+
+        // Camel's bean binding already discards equals, hashCode and the 
other java.lang.Object and java.lang.Proxy
+        // method names, but not toString
+        Method method = info.getMethod();
+        return !(method.getName().equals("toString") && 
method.getParameterCount() == 0);
+    }
+
+    /**
+     * Rejects a return type the producer cannot deliver to the route.
+     * <p>
+     * A method returning {@link TokenStream} hands back a stream nobody 
subscribes to: the producer would set it as the
+     * message body, the route would carry an object that never emits, and the 
caller would see neither an answer nor an
+     * error. The return type is known when the producer starts, so this fails 
there rather than silently at runtime.
+     *
+     * @throws IllegalArgumentException if the method returns a streaming type
+     */
+    private void validateReturnType() {
+        if (TokenStream.class.isAssignableFrom(targetMethod.getReturnType())) {
+            throw new IllegalArgumentException(
+                    "Method '" + targetMethod.getName() + "' of AI Service '" 
+ getEndpoint().getServiceName()
+                                               + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                               + ") returns " + 
targetMethod.getReturnType().getName()
+                                               + ". Streaming responses are 
not supported: the method must return a"
+                                               + " synchronous result.");
+        }
+    }
+
+    /**
+     * Lists the names of business methods for error messages.
+     *
+     * @param  methods the list of business methods
+     * @return         a comma-separated list of method names
+     */
+    private String listMethodNames(List<MethodInfo> methods) {
+        return methods.stream()
+                .map(info -> info.getMethod().getName())
+                .sorted()
+                .collect(Collectors.joining(", "));
+    }
+
+    /**
+     * Finds an annotation among the ones Camel's bean binding collected for a 
parameter.
+     *
+     * @param  annotations    the annotations collected for the parameter
+     * @param  annotationType the annotation to look for
+     * @return                the annotation, or null when the parameter does 
not carry it
+     */
+    private static <T extends Annotation> T findAnnotation(Annotation[] 
annotations, Class<T> annotationType) {
+        for (Annotation annotation : annotations) {
+            if (annotationType.isInstance(annotation)) {
+                return annotationType.cast(annotation);
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Computes parameter binding strategies by analyzing method parameters 
and their annotations.
+     * <p>
+     * The annotations come from Camel's bean binding, which collected them 
across the whole type hierarchy, so they are
+     * found even when the registered instance is a class generated by a 
framework. Validates that parameter bindings
+     * are unambiguous and fail-fast on configuration errors.
+     *
+     * @return                          list of parameter bindings, one per 
method parameter
+     * @throws IllegalArgumentException if parameter binding configuration is 
invalid
+     */
+    private List<ParameterBinding> computeParameterBindings() {
+        Parameter[] parameters = targetMethod.getParameters();
+        Annotation[][] parameterAnnotations = 
targetMethodInfo.getParameterAnnotations();
+        List<ParameterBinding> bindings = new ArrayList<>(parameters.length);
+
+        // Track @UserMessage and @MemoryId parameters for validation
+        int userMessageCount = 0;
+        int memoryIdCount = 0;
+
+        // Track template variable names for duplicate detection
+        Set<String> variableNames = new HashSet<>();
+
+        for (int i = 0; i < parameters.length; i++) {
+            Parameter param = parameters[i];
+            Class<?> paramType = param.getType();
+            // A class generated by a framework carries no parameter names, 
and the synthetic 'arg0' identifies
+            // nothing, so fall back to the position, saying "position" so it 
does not read like a name
+            String paramName = param.isNamePresent()
+                    ? "'" + param.getName() + "'"
+                    : "at position " + (i + 1);
+
+            // Check for annotations
+            Annotation[] annotations = parameterAnnotations[i];
+            UserMessage userMessageAnnotation = findAnnotation(annotations, 
UserMessage.class);
+            V vAnnotation = findAnnotation(annotations, V.class);
+            MemoryId memoryIdAnnotation = findAnnotation(annotations, 
MemoryId.class);
+
+            // Count how many binding annotations are present
+            int annotationCount = 0;
+            if (userMessageAnnotation != null) {
+                annotationCount++;
+            }
+            if (vAnnotation != null) {
+                annotationCount++;
+            }
+            if (memoryIdAnnotation != null) {
+                annotationCount++;
+            }
+
+            // Validate: no conflicting annotations
+            if (annotationCount > 1) {
+                List<String> conflictingAnnotations = new ArrayList<>();
+                if (userMessageAnnotation != null) {
+                    conflictingAnnotations.add("@UserMessage");
+                }
+                if (vAnnotation != null) {
+                    conflictingAnnotations.add("@V");
+                }
+                if (memoryIdAnnotation != null) {
+                    conflictingAnnotations.add("@MemoryId");
+                }
+                throw new IllegalArgumentException(
+                        "Parameter " + paramName + " on method '" + 
targetMethod.getName()
+                                                   + "' of AI Service '" + 
getEndpoint().getServiceName()
+                                                   + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                                   + ") has conflicting 
annotations: "
+                                                   + String.join(" and ", 
conflictingAnnotations)
+                                                   + ". A parameter can only 
have one binding annotation.");
+            }
+
+            // Create appropriate binding
+            if (userMessageAnnotation != null) {
+                userMessageCount++;
+                bindings.add(new UserMessageBinding(paramType, "the 
@UserMessage parameter"));
+            } else if (vAnnotation != null) {
+                String variableName = vAnnotation.value();
+                if (variableName.isEmpty()) {
+                    throw new IllegalArgumentException(
+                            "Parameter " + paramName + " on method '" + 
targetMethod.getName()
+                                                       + "' of AI Service '" + 
getEndpoint().getServiceName()
+                                                       + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                                       + ") has an empty @V 
template variable name.");
+                }
+                // Two parameters with the same variable name would silently 
feed from the same map key
+                if (!variableNames.add(variableName)) {
+                    throw new IllegalArgumentException(
+                            "Method '" + targetMethod.getName() + "' of AI 
Service '"
+                                                       + 
getEndpoint().getServiceName() + "' (endpoint: "
+                                                       + 
getEndpoint().getEndpointUri()
+                                                       + ") has multiple 
parameters annotated with @V(\"" + variableName
+                                                       + "\"). Template 
variable names must be unique.");
+                }
+
+                bindings.add(new TemplateVariableBinding(
+                        paramType, "the @V(\"" + variableName + "\") 
parameter", variableName));
+            } else if (memoryIdAnnotation != null) {
+                memoryIdCount++;
+                bindings.add(new MemoryIdBinding(paramType, "the @MemoryId 
parameter"));
+            } else {
+                // No annotation: fallback to body binding if it's the only 
parameter
+                if (parameters.length == 1) {
+                    bindings.add(new UserMessageBinding(paramType, "the 
parameter " + paramName));
+                } else {
+                    throw new IllegalArgumentException(
+                            "Parameter " + paramName + " on method '" + 
targetMethod.getName()
+                                                       + "' of AI Service '" + 
getEndpoint().getServiceName()
+                                                       + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                                       + ") has no binding 
annotation. When a method has multiple parameters, "
+                                                       + "each parameter must 
be annotated with @UserMessage, @V, or @MemoryId.");
+                }
+            }
+        }
+
+        // Validate: at most one @UserMessage parameter
+        if (userMessageCount > 1) {
+            throw new IllegalArgumentException(
+                    "Method '" + targetMethod.getName() + "' of AI Service '" 
+ getEndpoint().getServiceName()
+                                               + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                               + ") has multiple @UserMessage 
parameters. Only one parameter can be annotated with @UserMessage.");
+        }
+
+        // Validate: at most one @MemoryId parameter (they would all silently 
feed from the same header)
+        if (memoryIdCount > 1) {
+            throw new IllegalArgumentException(
+                    "Method '" + targetMethod.getName() + "' of AI Service '" 
+ getEndpoint().getServiceName()
+                                               + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                               + ") has multiple @MemoryId 
parameters. Only one parameter can be annotated with @MemoryId.");
+        }
+
+        return bindings;
+    }
+
+    @Override
+    public void process(Exchange exchange) throws Exception {
+        // 1. Resolve parameter values
+        Object[] args = new Object[parameterBindings.size()];
+        for (int i = 0; i < parameterBindings.size(); i++) {
+            ParameterBinding binding = parameterBindings.get(i);
+            try {
+                args[i] = binding.resolve(exchange);
+            } catch (Exception e) {
+                throw new IllegalArgumentException(
+                        "Failed to resolve " + binding.describe() + " for 
method '"
+                                                   + targetMethod.getName() + 
"' of AI Service '"
+                                                   + 
getEndpoint().getServiceName() + "' (endpoint: "
+                                                   + 
getEndpoint().getEndpointUri() + "): " + e.getMessage(),
+                        e);
+            }
+        }
+
+        // 2. Invoke method
+        Object result;
+        try {
+            result = ObjectHelper.invokeMethodSafe(targetMethod, 
serviceInstance, args);
+        } catch (InvocationTargetException e) {

Review Comment:
   The other LangChain4j producers call `GenAiErrorSupport.apply` before 
rethrowing, which sets the error category and retry-after. That is also the 
guardrail error mapping the JIRA mentions.
   
   _Generated with [Claude Code](https://claude.com/claude-code) on behalf of 
@JiriOndrusek_



##########
components/camel-ai/camel-langchain4j-service/src/main/java/org/apache/camel/component/langchain4j/service/LangChain4jServiceProducer.java:
##########
@@ -0,0 +1,540 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.langchain4j.service;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Parameter;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import dev.langchain4j.service.MemoryId;
+import dev.langchain4j.service.TokenStream;
+import dev.langchain4j.service.UserMessage;
+import dev.langchain4j.service.V;
+import org.apache.camel.Exchange;
+import org.apache.camel.NoSuchBeanException;
+import org.apache.camel.NoSuchHeaderException;
+import org.apache.camel.component.bean.BeanInfo;
+import org.apache.camel.component.bean.MethodInfo;
+import org.apache.camel.support.DefaultProducer;
+import org.apache.camel.support.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Producer that invokes LangChain4j AI Service methods with parameter binding 
from Camel exchanges.
+ * <p>
+ * Method resolution is delegated to Camel's bean binding ({@link BeanInfo}), 
which pools the methods of the service
+ * instance and of every interface it implements, and collects each 
parameter's annotations from wherever they are
+ * declared. The producer then binds the parameters from the exchange body and 
headers according to the LangChain4j
+ * annotations:
+ * <ul>
+ * <li>{@code @UserMessage} - binds from exchange body</li>
+ * <li>{@code @V("variableName")} - binds from the {@code "variableName"} key 
of the
+ * {@code CamelLangChain4jServiceVariables} map header</li>
+ * <li>{@code @MemoryId} - binds from header {@code 
CamelLangChain4jServiceMemoryId}</li>
+ * </ul>
+ * <p>
+ * The AI Service is looked up in the registry and its target method resolved 
when the producer starts, so
+ * {@code lazyStartProducer=true} defers both the resolution and its failures 
to the first message. Parameter binding
+ * strategies are computed once at the same time for thread-safe, efficient 
invocation, and every start recomputes them,
+ * so a restarted producer picks up a service that was rebound in the registry 
meanwhile.
+ */
+public class LangChain4jServiceProducer extends DefaultProducer {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(LangChain4jServiceProducer.class);
+
+    private Object serviceInstance;
+    private MethodInfo targetMethodInfo;
+    private Method targetMethod;
+    private List<ParameterBinding> parameterBindings;
+
+    /**
+     * Creates a new producer.
+     *
+     * @param endpoint the endpoint
+     */
+    public LangChain4jServiceProducer(LangChain4jServiceEndpoint endpoint) {
+        super(endpoint);
+    }
+
+    @Override
+    public LangChain4jServiceEndpoint getEndpoint() {
+        return (LangChain4jServiceEndpoint) super.getEndpoint();
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+
+        // Resolve on producer start (not endpoint init) so lazyStartProducer 
can defer failures
+        serviceInstance = lookupServiceInstance();
+        targetMethodInfo = resolveTargetMethod();
+        targetMethod = targetMethodInfo.getMethod();
+        validateReturnType();
+        parameterBindings = computeParameterBindings();
+
+        LOG.debug("Started producer for AI Service '{}' method '{}' with {} 
parameter bindings",
+                getEndpoint().getServiceName(), targetMethod.getName(), 
parameterBindings.size());
+    }
+
+    /**
+     * Looks up the AI Service instance in the Camel registry.
+     *
+     * @return                     the AI Service instance
+     * @throws NoSuchBeanException if no bean is registered under the 
configured service name
+     */
+    private Object lookupServiceInstance() {
+        String serviceName = getEndpoint().getServiceName();
+        Object instance = 
getEndpoint().getCamelContext().getRegistry().lookupByName(serviceName);
+        if (instance == null) {
+            throw new NoSuchBeanException(serviceName);
+        }
+        return instance;
+    }
+
+    /**
+     * Resolves the method to invoke on the AI Service.
+     * <p>
+     * The introspection is delegated to Camel's bean binding, so the method 
is found whatever shape the registered
+     * instance has, and each parameter carries the annotations declared on 
the AI Service interface.
+     *
+     * @return                          the resolved method
+     * @throws IllegalArgumentException if method resolution fails
+     */
+    private MethodInfo resolveTargetMethod() {
+        String serviceName = getEndpoint().getServiceName();
+        BeanInfo beanInfo = new BeanInfo(getEndpoint().getCamelContext(), 
serviceInstance.getClass());
+
+        List<MethodInfo> businessMethods = beanInfo.getMethods().stream()
+                .filter(this::isBusinessMethod)
+                .collect(Collectors.toList());
+
+        if (businessMethods.isEmpty()) {
+            throw new IllegalArgumentException(
+                    "AI Service '" + serviceName + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                               + ") has no method to invoke");
+        }
+
+        String methodName = getEndpoint().getConfiguration().getMethod();
+
+        if (businessMethods.size() == 1) {
+            MethodInfo single = businessMethods.get(0);
+            // An explicitly configured method name must still match (never 
ignore it silently)
+            if (methodName != null && !methodName.isEmpty() && 
!single.getMethod().getName().equals(methodName)) {
+                throw new IllegalArgumentException(
+                        "Method '" + methodName + "' not found on AI Service 
'" + serviceName
+                                                   + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                                   + "). Available methods: " 
+ single.getMethod().getName());
+            }
+            return single;
+        }
+
+        // Multiple methods: require an explicit method parameter. A service 
instance built by a framework exposes the
+        // framework's own methods next to the AI Service ones, so this is the 
normal case outside plain Java
+        if (methodName == null || methodName.isEmpty()) {
+            throw new IllegalArgumentException(
+                    "AI Service '" + serviceName + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                               + ") has multiple methods. 
Specify method parameter. Available methods: "
+                                               + 
listMethodNames(businessMethods));
+        }
+
+        List<MethodInfo> matchingMethods = businessMethods.stream()
+                .filter(info -> info.getMethod().getName().equals(methodName))
+                .collect(Collectors.toList());
+
+        if (matchingMethods.isEmpty()) {
+            throw new IllegalArgumentException(
+                    "Method '" + methodName + "' not found on AI Service '" + 
serviceName
+                                               + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                               + "). Available methods: " + 
listMethodNames(businessMethods));
+        }
+
+        if (matchingMethods.size() > 1) {
+            throw new IllegalArgumentException(
+                    "AI Service '" + serviceName + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                               + ") has multiple methods named 
'" + methodName
+                                               + "'. Method overloading is not 
supported: method names must be unique.");
+        }
+
+        return matchingMethods.get(0);
+    }
+
+    /**
+     * Checks if a method is a business method (abstract instance method, not 
default, static, or Object method).
+     *
+     * @param  info the method to check, as Camel's bean binding describes it
+     * @return      true if the method is a business method
+     */
+    private boolean isBusinessMethod(MethodInfo info) {
+        // A static method is never invoked on the instance. A default method, 
on the other hand, is a candidate like
+        // any other: it is callable, and a service built by a framework 
implements it as a concrete method anyway, so
+        // there would be no way to tell it apart
+        if (info.isStaticMethod()) {
+            return false;
+        }
+
+        // Camel's bean binding already discards equals, hashCode and the 
other java.lang.Object and java.lang.Proxy
+        // method names, but not toString
+        Method method = info.getMethod();
+        return !(method.getName().equals("toString") && 
method.getParameterCount() == 0);
+    }
+
+    /**
+     * Rejects a return type the producer cannot deliver to the route.
+     * <p>
+     * A method returning {@link TokenStream} hands back a stream nobody 
subscribes to: the producer would set it as the
+     * message body, the route would carry an object that never emits, and the 
caller would see neither an answer nor an
+     * error. The return type is known when the producer starts, so this fails 
there rather than silently at runtime.
+     *
+     * @throws IllegalArgumentException if the method returns a streaming type
+     */
+    private void validateReturnType() {
+        if (TokenStream.class.isAssignableFrom(targetMethod.getReturnType())) {
+            throw new IllegalArgumentException(
+                    "Method '" + targetMethod.getName() + "' of AI Service '" 
+ getEndpoint().getServiceName()
+                                               + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                               + ") returns " + 
targetMethod.getReturnType().getName()
+                                               + ". Streaming responses are 
not supported: the method must return a"
+                                               + " synchronous result.");
+        }
+    }
+
+    /**
+     * Lists the names of business methods for error messages.
+     *
+     * @param  methods the list of business methods
+     * @return         a comma-separated list of method names
+     */
+    private String listMethodNames(List<MethodInfo> methods) {
+        return methods.stream()
+                .map(info -> info.getMethod().getName())
+                .sorted()
+                .collect(Collectors.joining(", "));
+    }
+
+    /**
+     * Finds an annotation among the ones Camel's bean binding collected for a 
parameter.
+     *
+     * @param  annotations    the annotations collected for the parameter
+     * @param  annotationType the annotation to look for
+     * @return                the annotation, or null when the parameter does 
not carry it
+     */
+    private static <T extends Annotation> T findAnnotation(Annotation[] 
annotations, Class<T> annotationType) {
+        for (Annotation annotation : annotations) {
+            if (annotationType.isInstance(annotation)) {
+                return annotationType.cast(annotation);
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Computes parameter binding strategies by analyzing method parameters 
and their annotations.
+     * <p>
+     * The annotations come from Camel's bean binding, which collected them 
across the whole type hierarchy, so they are
+     * found even when the registered instance is a class generated by a 
framework. Validates that parameter bindings
+     * are unambiguous and fail-fast on configuration errors.
+     *
+     * @return                          list of parameter bindings, one per 
method parameter
+     * @throws IllegalArgumentException if parameter binding configuration is 
invalid
+     */
+    private List<ParameterBinding> computeParameterBindings() {
+        Parameter[] parameters = targetMethod.getParameters();
+        Annotation[][] parameterAnnotations = 
targetMethodInfo.getParameterAnnotations();
+        List<ParameterBinding> bindings = new ArrayList<>(parameters.length);
+
+        // Track @UserMessage and @MemoryId parameters for validation
+        int userMessageCount = 0;
+        int memoryIdCount = 0;
+
+        // Track template variable names for duplicate detection
+        Set<String> variableNames = new HashSet<>();
+
+        for (int i = 0; i < parameters.length; i++) {
+            Parameter param = parameters[i];
+            Class<?> paramType = param.getType();
+            // A class generated by a framework carries no parameter names, 
and the synthetic 'arg0' identifies
+            // nothing, so fall back to the position, saying "position" so it 
does not read like a name
+            String paramName = param.isNamePresent()
+                    ? "'" + param.getName() + "'"
+                    : "at position " + (i + 1);
+
+            // Check for annotations
+            Annotation[] annotations = parameterAnnotations[i];
+            UserMessage userMessageAnnotation = findAnnotation(annotations, 
UserMessage.class);
+            V vAnnotation = findAnnotation(annotations, V.class);
+            MemoryId memoryIdAnnotation = findAnnotation(annotations, 
MemoryId.class);
+
+            // Count how many binding annotations are present
+            int annotationCount = 0;
+            if (userMessageAnnotation != null) {
+                annotationCount++;
+            }
+            if (vAnnotation != null) {
+                annotationCount++;
+            }
+            if (memoryIdAnnotation != null) {
+                annotationCount++;
+            }
+
+            // Validate: no conflicting annotations
+            if (annotationCount > 1) {
+                List<String> conflictingAnnotations = new ArrayList<>();
+                if (userMessageAnnotation != null) {
+                    conflictingAnnotations.add("@UserMessage");
+                }
+                if (vAnnotation != null) {
+                    conflictingAnnotations.add("@V");
+                }
+                if (memoryIdAnnotation != null) {
+                    conflictingAnnotations.add("@MemoryId");
+                }
+                throw new IllegalArgumentException(
+                        "Parameter " + paramName + " on method '" + 
targetMethod.getName()
+                                                   + "' of AI Service '" + 
getEndpoint().getServiceName()
+                                                   + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                                   + ") has conflicting 
annotations: "
+                                                   + String.join(" and ", 
conflictingAnnotations)
+                                                   + ". A parameter can only 
have one binding annotation.");
+            }
+
+            // Create appropriate binding
+            if (userMessageAnnotation != null) {
+                userMessageCount++;
+                bindings.add(new UserMessageBinding(paramType, "the 
@UserMessage parameter"));
+            } else if (vAnnotation != null) {
+                String variableName = vAnnotation.value();
+                if (variableName.isEmpty()) {
+                    throw new IllegalArgumentException(
+                            "Parameter " + paramName + " on method '" + 
targetMethod.getName()
+                                                       + "' of AI Service '" + 
getEndpoint().getServiceName()
+                                                       + "' (endpoint: " + 
getEndpoint().getEndpointUri()
+                                                       + ") has an empty @V 
template variable name.");
+                }
+                // Two parameters with the same variable name would silently 
feed from the same map key
+                if (!variableNames.add(variableName)) {
+                    throw new IllegalArgumentException(
+                            "Method '" + targetMethod.getName() + "' of AI 
Service '"
+                                                       + 
getEndpoint().getServiceName() + "' (endpoint: "
+                                                       + 
getEndpoint().getEndpointUri()
+                                                       + ") has multiple 
parameters annotated with @V(\"" + variableName
+                                                       + "\"). Template 
variable names must be unique.");
+                }
+
+                bindings.add(new TemplateVariableBinding(
+                        paramType, "the @V(\"" + variableName + "\") 
parameter", variableName));
+            } else if (memoryIdAnnotation != null) {
+                memoryIdCount++;
+                bindings.add(new MemoryIdBinding(paramType, "the @MemoryId 
parameter"));
+            } else {

Review Comment:
   A lone `@UserName` or `InvocationParameters` parameter gets the body and 
fails on every message; startup could reject these kinds by name.
   
   _Generated with [Claude Code](https://claude.com/claude-code) on behalf of 
@JiriOndrusek_



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to