You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2024/03/12 09:07:50 UTC
(camel) branch main updated: CAMEL-20543 - Camel-AWS-Bedrock-Agent: Support more operations on the producer side (#13455)
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 16a770c53fe CAMEL-20543 - Camel-AWS-Bedrock-Agent: Support more operations on the producer side (#13455)
16a770c53fe is described below
commit 16a770c53fe743c4a81280f8fc911984161e80de
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Mar 12 10:07:44 2024 +0100
CAMEL-20543 - Camel-AWS-Bedrock-Agent: Support more operations on the producer side (#13455)
* CAMEL-20543 - Camel-AWS-Bedrock-Agent: Support more operations on the producer side
Signed-off-by: Andrea Cosentino <an...@gmail.com>
* CAMEL-20543 - Camel-AWS-Bedrock-Agent: Support more operations on the producer side
Signed-off-by: Andrea Cosentino <an...@gmail.com>
* CAMEL-20543 - Camel-AWS-Bedrock-Agent: Support more operations on the producer side
Signed-off-by: Andrea Cosentino <an...@gmail.com>
---------
Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
.../catalog/components/aws-bedrock-agent.json | 4 +-
.../aws2/bedrock/agent/aws-bedrock-agent.json | 4 +-
.../aws2/bedrock/agent/BedrockAgentConstants.java | 4 ++
.../aws2/bedrock/agent/BedrockAgentOperations.java | 4 +-
.../aws2/bedrock/agent/BedrockAgentProducer.java | 69 ++++++++++++++++++++--
.../agent/integration/BedrockAgentProducerIT.java | 1 -
6 files changed, 76 insertions(+), 10 deletions(-)
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-bedrock-agent.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-bedrock-agent.json
index 5038d9dfe2a..b8860108341 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-bedrock-agent.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-bedrock-agent.json
@@ -27,7 +27,7 @@
"dataSourceId": { "index": 1, "kind": "property", "displayName": "Data Source Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "Define the Data source Id we are going to use" },
"knowledgeBaseId": { "index": 2, "kind": "property", "displayName": "Knowledge Base Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "Define the Knowledge Base Id we are going to use" },
"modelId": { "index": 3, "kind": "property", "displayName": "Model Id", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "enum": [ "anthropic.claude-instant-v1", "anthropic.claude-v2", "anthropic.claude-v2:1" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "descrip [...]
- "operation": { "index": 4, "kind": "property", "displayName": "Operation", "group": "common", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentOperations", "enum": [ "startIngestionJob", "listIngestionJobs" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "config [...]
+ "operation": { "index": 4, "kind": "property", "displayName": "Operation", "group": "common", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentOperations", "enum": [ "startIngestionJob", "listIngestionJobs", "getIngestionJob" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configura [...]
"overrideEndpoint": { "index": 5, "kind": "property", "displayName": "Override Endpoint", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "Set the need for overriding the endpoint. This option needs to be used i [...]
"pojoRequest": { "index": 6, "kind": "property", "displayName": "Pojo Request", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "If we want to use a POJO request as body or not" },
"profileCredentialsName": { "index": 7, "kind": "property", "displayName": "Profile Credentials Name", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "false", "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "If using a profile credentials provider, this par [...]
@@ -61,7 +61,7 @@
"dataSourceId": { "index": 1, "kind": "parameter", "displayName": "Data Source Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "Define the Data source Id we are going to use" },
"knowledgeBaseId": { "index": 2, "kind": "parameter", "displayName": "Knowledge Base Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "Define the Knowledge Base Id we are going to use" },
"modelId": { "index": 3, "kind": "parameter", "displayName": "Model Id", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "enum": [ "anthropic.claude-instant-v1", "anthropic.claude-v2", "anthropic.claude-v2:1" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "descri [...]
- "operation": { "index": 4, "kind": "parameter", "displayName": "Operation", "group": "common", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentOperations", "enum": [ "startIngestionJob", "listIngestionJobs" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "confi [...]
+ "operation": { "index": 4, "kind": "parameter", "displayName": "Operation", "group": "common", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentOperations", "enum": [ "startIngestionJob", "listIngestionJobs", "getIngestionJob" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configur [...]
"overrideEndpoint": { "index": 5, "kind": "parameter", "displayName": "Override Endpoint", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "Set the need for overriding the endpoint. This option needs to be used [...]
"pojoRequest": { "index": 6, "kind": "parameter", "displayName": "Pojo Request", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "If we want to use a POJO request as body or not" },
"profileCredentialsName": { "index": 7, "kind": "parameter", "displayName": "Profile Credentials Name", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "false", "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "If using a profile credentials provider, this pa [...]
diff --git a/components/camel-aws/camel-aws-bedrock/src/generated/resources/META-INF/org/apache/camel/component/aws2/bedrock/agent/aws-bedrock-agent.json b/components/camel-aws/camel-aws-bedrock/src/generated/resources/META-INF/org/apache/camel/component/aws2/bedrock/agent/aws-bedrock-agent.json
index 5038d9dfe2a..b8860108341 100644
--- a/components/camel-aws/camel-aws-bedrock/src/generated/resources/META-INF/org/apache/camel/component/aws2/bedrock/agent/aws-bedrock-agent.json
+++ b/components/camel-aws/camel-aws-bedrock/src/generated/resources/META-INF/org/apache/camel/component/aws2/bedrock/agent/aws-bedrock-agent.json
@@ -27,7 +27,7 @@
"dataSourceId": { "index": 1, "kind": "property", "displayName": "Data Source Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "Define the Data source Id we are going to use" },
"knowledgeBaseId": { "index": 2, "kind": "property", "displayName": "Knowledge Base Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "Define the Knowledge Base Id we are going to use" },
"modelId": { "index": 3, "kind": "property", "displayName": "Model Id", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "enum": [ "anthropic.claude-instant-v1", "anthropic.claude-v2", "anthropic.claude-v2:1" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "descrip [...]
- "operation": { "index": 4, "kind": "property", "displayName": "Operation", "group": "common", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentOperations", "enum": [ "startIngestionJob", "listIngestionJobs" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "config [...]
+ "operation": { "index": 4, "kind": "property", "displayName": "Operation", "group": "common", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentOperations", "enum": [ "startIngestionJob", "listIngestionJobs", "getIngestionJob" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configura [...]
"overrideEndpoint": { "index": 5, "kind": "property", "displayName": "Override Endpoint", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "Set the need for overriding the endpoint. This option needs to be used i [...]
"pojoRequest": { "index": 6, "kind": "property", "displayName": "Pojo Request", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "If we want to use a POJO request as body or not" },
"profileCredentialsName": { "index": 7, "kind": "property", "displayName": "Profile Credentials Name", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "false", "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "If using a profile credentials provider, this par [...]
@@ -61,7 +61,7 @@
"dataSourceId": { "index": 1, "kind": "parameter", "displayName": "Data Source Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "Define the Data source Id we are going to use" },
"knowledgeBaseId": { "index": 2, "kind": "parameter", "displayName": "Knowledge Base Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "Define the Knowledge Base Id we are going to use" },
"modelId": { "index": 3, "kind": "parameter", "displayName": "Model Id", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "enum": [ "anthropic.claude-instant-v1", "anthropic.claude-v2", "anthropic.claude-v2:1" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "descri [...]
- "operation": { "index": 4, "kind": "parameter", "displayName": "Operation", "group": "common", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentOperations", "enum": [ "startIngestionJob", "listIngestionJobs" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "confi [...]
+ "operation": { "index": 4, "kind": "parameter", "displayName": "Operation", "group": "common", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentOperations", "enum": [ "startIngestionJob", "listIngestionJobs", "getIngestionJob" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configur [...]
"overrideEndpoint": { "index": 5, "kind": "parameter", "displayName": "Override Endpoint", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "Set the need for overriding the endpoint. This option needs to be used [...]
"pojoRequest": { "index": 6, "kind": "parameter", "displayName": "Pojo Request", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "If we want to use a POJO request as body or not" },
"profileCredentialsName": { "index": 7, "kind": "parameter", "displayName": "Profile Credentials Name", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "false", "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "If using a profile credentials provider, this pa [...]
diff --git a/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/agent/BedrockAgentConstants.java b/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/agent/BedrockAgentConstants.java
index fb8ed36ba53..3fd88d8c9c8 100644
--- a/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/agent/BedrockAgentConstants.java
+++ b/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/agent/BedrockAgentConstants.java
@@ -40,4 +40,8 @@ public interface BedrockAgentConstants {
@Metadata(description = "The header contains the status of the ingestion job",
javaType = "String", label = "consumer")
String INGESTION_JOB_STATUS = "CamelAwsBedrockAgentIngestionJobStatus";
+
+ @Metadata(description = "The header contains the id of the ingestion job",
+ javaType = "String", label = "producer")
+ String INGESTION_JOB_ID = "CamelAwsBedrockAgentIngestionJobId";
}
diff --git a/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/agent/BedrockAgentOperations.java b/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/agent/BedrockAgentOperations.java
index 57710e6951e..4fb08645cfe 100644
--- a/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/agent/BedrockAgentOperations.java
+++ b/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/agent/BedrockAgentOperations.java
@@ -20,5 +20,7 @@ public enum BedrockAgentOperations {
startIngestionJob,
- listIngestionJobs
+ listIngestionJobs,
+
+ getIngestionJob
}
diff --git a/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/agent/BedrockAgentProducer.java b/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/agent/BedrockAgentProducer.java
index 4ba7a381003..0dc35211750 100644
--- a/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/agent/BedrockAgentProducer.java
+++ b/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/agent/BedrockAgentProducer.java
@@ -27,10 +27,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.services.bedrockagent.BedrockAgentClient;
-import software.amazon.awssdk.services.bedrockagent.model.ListIngestionJobsRequest;
-import software.amazon.awssdk.services.bedrockagent.model.ListIngestionJobsResponse;
-import software.amazon.awssdk.services.bedrockagent.model.StartIngestionJobRequest;
-import software.amazon.awssdk.services.bedrockagent.model.StartIngestionJobResponse;
+import software.amazon.awssdk.services.bedrockagent.model.*;
/**
* A Producer which sends messages to the Amazon Bedrock Agent Service <a href="http://aws.amazon.com/bedrock/">AWS
@@ -54,6 +51,9 @@ public class BedrockAgentProducer extends DefaultProducer {
case listIngestionJobs:
listIngestionJobs(getEndpoint().getBedrockAgentClient(), exchange);
break;
+ case getIngestionJob:
+ getIngestionJob(getEndpoint().getBedrockAgentClient(), exchange);
+ break;
default:
throw new IllegalArgumentException("Unsupported operation");
}
@@ -176,6 +176,62 @@ public class BedrockAgentProducer extends DefaultProducer {
}
}
+ private void getIngestionJob(BedrockAgentClient bedrockAgentClient, Exchange exchange)
+ throws InvalidPayloadException {
+ if (getConfiguration().isPojoRequest()) {
+ Object payload = exchange.getMessage().getMandatoryBody();
+ if (payload instanceof GetIngestionJobRequest) {
+ GetIngestionJobResponse result;
+ try {
+ result = bedrockAgentClient.getIngestionJob((GetIngestionJobRequest) payload);
+ } catch (AwsServiceException ase) {
+ LOG.trace("Get Ingestion Job command returned the error code {}", ase.awsErrorDetails().errorCode());
+ throw ase;
+ }
+ Message message = getMessageForResponse(exchange);
+ prepareGetIngestionJobResponse(result, message);
+ }
+ } else {
+ String knowledgeBaseId;
+ String dataSourceId;
+ String ingestionJobId;
+ GetIngestionJobRequest.Builder builder = GetIngestionJobRequest.builder();
+ if (ObjectHelper.isEmpty(getConfiguration().getKnowledgeBaseId())) {
+ if (ObjectHelper.isNotEmpty(exchange.getMessage().getHeader(BedrockAgentConstants.KNOWLEDGE_BASE_ID))) {
+ knowledgeBaseId = exchange.getMessage().getHeader(BedrockAgentConstants.KNOWLEDGE_BASE_ID, String.class);
+ } else {
+ throw new IllegalArgumentException("KnowledgeBaseId must be specified");
+ }
+ } else {
+ knowledgeBaseId = getConfiguration().getKnowledgeBaseId();
+ }
+ if (ObjectHelper.isEmpty(getConfiguration().getDataSourceId())) {
+ if (ObjectHelper.isNotEmpty(exchange.getMessage().getHeader(BedrockAgentConstants.DATASOURCE_ID))) {
+ dataSourceId = exchange.getMessage().getHeader(BedrockAgentConstants.DATASOURCE_ID, String.class);
+ } else {
+ throw new IllegalArgumentException("DataSourceId must be specified");
+ }
+ } else {
+ dataSourceId = getConfiguration().getDataSourceId();
+ }
+ if (ObjectHelper.isEmpty(getConfiguration().getIngestionJobId())) {
+ if (ObjectHelper.isNotEmpty(exchange.getMessage().getHeader(BedrockAgentConstants.INGESTION_JOB_ID))) {
+ ingestionJobId = exchange.getMessage().getHeader(BedrockAgentConstants.INGESTION_JOB_ID, String.class);
+ } else {
+ throw new IllegalArgumentException("IngestionJobId must be specified");
+ }
+ } else {
+ ingestionJobId = getConfiguration().getIngestionJobId();
+ }
+ builder.knowledgeBaseId(knowledgeBaseId);
+ builder.dataSourceId(dataSourceId);
+ builder.ingestionJobId(ingestionJobId);
+ GetIngestionJobResponse output = bedrockAgentClient.getIngestionJob(builder.build());
+ Message message = getMessageForResponse(exchange);
+ prepareGetIngestionJobResponse(output, message);
+ }
+ }
+
private void prepareIngestionJobResponse(StartIngestionJobResponse result, Message message) {
message.setBody(result.ingestionJob().ingestionJobId());
}
@@ -186,6 +242,11 @@ public class BedrockAgentProducer extends DefaultProducer {
}
}
+ private void prepareGetIngestionJobResponse(GetIngestionJobResponse result, Message message) {
+ message.setBody(result.ingestionJob().ingestionJobId());
+ message.setHeader(BedrockAgentConstants.INGESTION_JOB_STATUS, result.ingestionJob().status());
+ }
+
public static Message getMessageForResponse(final Exchange exchange) {
return exchange.getMessage();
}
diff --git a/components/camel-aws/camel-aws-bedrock/src/test/java/org/apache/camel/component/aws2/bedrock/agent/integration/BedrockAgentProducerIT.java b/components/camel-aws/camel-aws-bedrock/src/test/java/org/apache/camel/component/aws2/bedrock/agent/integration/BedrockAgentProducerIT.java
index 2de238a7fb4..8d04c59668b 100644
--- a/components/camel-aws/camel-aws-bedrock/src/test/java/org/apache/camel/component/aws2/bedrock/agent/integration/BedrockAgentProducerIT.java
+++ b/components/camel-aws/camel-aws-bedrock/src/test/java/org/apache/camel/component/aws2/bedrock/agent/integration/BedrockAgentProducerIT.java
@@ -76,7 +76,6 @@ class BedrockAgentProducerIT extends CamelTestSupport {
.to(result);
from("direct:list_ingestion_jobs")
.to("aws-bedrock-agent:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}}®ion=us-east-1&operation=listIngestionJobs")
- .log("${body}")
.to(result);
}
};