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 2020/11/11 13:26:06 UTC
[camel] 01/03: CAMEL-15812 - Camel-Git: Better structure for
consumer returned object - Tag consumer
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit a3da7b578c9a02fc2527336bdcf154b3c49da889
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Nov 11 14:22:36 2020 +0100
CAMEL-15812 - Camel-Git: Better structure for consumer returned object - Tag consumer
---
.../src/main/java/org/apache/camel/component/git/GitConstants.java | 2 ++
.../java/org/apache/camel/component/git/consumer/GitTagConsumer.java | 5 ++++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/components/camel-git/src/main/java/org/apache/camel/component/git/GitConstants.java b/components/camel-git/src/main/java/org/apache/camel/component/git/GitConstants.java
index 6b6a48f..7894c9c 100644
--- a/components/camel-git/src/main/java/org/apache/camel/component/git/GitConstants.java
+++ b/components/camel-git/src/main/java/org/apache/camel/component/git/GitConstants.java
@@ -29,4 +29,6 @@ public interface GitConstants {
String GIT_COMMIT_TIME = "CamelGitCommitTime";
String GIT_BRANCH_LEAF = "CamelGitBranchLeaf";
String GIT_BRANCH_OBJECT_ID = "CamelGitBranchObjectId";
+ String GIT_TAG_LEAF = "CamelGitTagLeaf";
+ String GIT_TAG_OBJECT_ID = "CamelGitTagObjectId";
}
diff --git a/components/camel-git/src/main/java/org/apache/camel/component/git/consumer/GitTagConsumer.java b/components/camel-git/src/main/java/org/apache/camel/component/git/consumer/GitTagConsumer.java
index fae0eed..31ea39a 100644
--- a/components/camel-git/src/main/java/org/apache/camel/component/git/consumer/GitTagConsumer.java
+++ b/components/camel-git/src/main/java/org/apache/camel/component/git/consumer/GitTagConsumer.java
@@ -21,6 +21,7 @@ import java.util.List;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
+import org.apache.camel.component.git.GitConstants;
import org.apache.camel.component.git.GitEndpoint;
import org.eclipse.jgit.lib.Ref;
@@ -39,7 +40,9 @@ public class GitTagConsumer extends AbstractGitConsumer {
for (Ref ref : call) {
if (!tagsConsumed.contains(ref.getName())) {
Exchange e = getEndpoint().createExchange();
- e.getOut().setBody(ref);
+ e.getMessage().setBody(ref.getName());
+ e.getMessage().setHeader(GitConstants.GIT_BRANCH_LEAF, ref.getLeaf().getName());
+ e.getMessage().setHeader(GitConstants.GIT_BRANCH_OBJECT_ID, ref.getObjectId().getName());
getProcessor().process(e);
tagsConsumed.add(ref.getName());
count++;