karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KARAF-5659) Upgrade to Kafka 1.1.x
Date Thu, 06 Sep 2018 17:20:00 GMT

    [ https://issues.apache.org/jira/browse/KARAF-5659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16606103#comment-16606103
] 

ASF GitHub Bot commented on KARAF-5659:
---------------------------------------

fpapon closed pull request #46: [KARAF-5659] Upgrade to Kafka 1.1.1
URL: https://github.com/apache/karaf-decanter/pull/46
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/assembly/src/main/feature/feature.xml b/assembly/src/main/feature/feature.xml
index 0493b72..55d7819 100644
--- a/assembly/src/main/feature/feature.xml
+++ b/assembly/src/main/feature/feature.xml
@@ -117,7 +117,7 @@
 
 	<feature name="decanter-collector-kafka-core" version="${project.version}" description="Karaf
Decanter Kafka Collector core">
         <feature>decanter-common</feature>
-        <bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.kafka-clients/0.9.0.0_1</bundle>
+        <bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.kafka-clients/1.1.1_1</bundle>
         <bundle>mvn:org.apache.karaf.decanter.collector/org.apache.karaf.decanter.collector.kafka/${project.version}</bundle>
     </feature>
     
@@ -271,7 +271,7 @@
 
     <feature name="decanter-appender-kafka-core" version="${project.version}" description="Karaf
Decanter Kafka Appender core">
         <feature>decanter-common</feature>
-        <bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.kafka-clients/0.9.0.0_1</bundle>
+        <bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.kafka-clients/1.1.1_1</bundle>
         <bundle>mvn:org.apache.karaf.decanter.appender/org.apache.karaf.decanter.appender.kafka/${project.version}</bundle>
     </feature>
 
diff --git a/collector/kafka/src/main/cfg/org.apache.karaf.decanter.collector.kafka.cfg b/collector/kafka/src/main/cfg/org.apache.karaf.decanter.collector.kafka.cfg
index 6342dfe..15ebd09 100644
--- a/collector/kafka/src/main/cfg/org.apache.karaf.decanter.collector.kafka.cfg
+++ b/collector/kafka/src/main/cfg/org.apache.karaf.decanter.collector.kafka.cfg
@@ -75,5 +75,11 @@
 # Security (SASL)
 # For SASL, you have to configure Java System property as explained in http://kafka.apache.org/documentation.html#security_ssl
 
-# Unmarshaller to use
-unmarshaller.target=(dataFormat=json)
\ No newline at end of file
+# message type (text to use the unmarshaller or raw to not use it)
+message.type=text
+
+# Unmarshaller to use (json is recommended)
+unmarshaller.target=(dataFormat=json)
+
+# custom fields
+fields.remove.request-size-max=remove
\ No newline at end of file
diff --git a/collector/kafka/src/main/java/org/apache/karaf/decanter/collector/kafka/KafkaCollector.java
b/collector/kafka/src/main/java/org/apache/karaf/decanter/collector/kafka/KafkaCollector.java
index a805de3..7c6807f 100644
--- a/collector/kafka/src/main/java/org/apache/karaf/decanter/collector/kafka/KafkaCollector.java
+++ b/collector/kafka/src/main/java/org/apache/karaf/decanter/collector/kafka/KafkaCollector.java
@@ -54,6 +54,7 @@
     private String topic;
     private String eventAdminTopic;
     private boolean consuming = false;
+    private String messageType;
 
     @Reference
     public EventAdmin dispatcher;
@@ -68,6 +69,7 @@ public void activate(ComponentContext componentContext) {
 
         topic = getValue(properties, "topic", "decanter");
         eventAdminTopic = getValue(properties, EventConstants.EVENT_TOPIC, "decanter/collect/kafka/decanter");
+        messageType = getValue(properties, "message.type", "text");
 
         Properties config = new Properties();
 
@@ -175,8 +177,12 @@ private void consume() throws UnsupportedEncodingException {
         
         for (ConsumerRecord<String, String> record : records) {
             String value = record.value();
-            ByteArrayInputStream is = new ByteArrayInputStream(value.getBytes("utf-8"));
-            data.putAll(unmarshaller.unmarshal(is));
+            if (messageType.equalsIgnoreCase("text")) {
+                ByteArrayInputStream is = new ByteArrayInputStream(value.getBytes("utf-8"));
+                data.putAll(unmarshaller.unmarshal(is));
+            } else {
+                data.put("payload", value);
+            }
         }
 
         try {
diff --git a/pom.xml b/pom.xml
index 526603c..1d05eae 100644
--- a/pom.xml
+++ b/pom.xml
@@ -52,7 +52,7 @@
         <elasticsearch6.bundle.version>6.2.4_1</elasticsearch6.bundle.version>
         <glassfish-json.version>1.0.4</glassfish-json.version>
         <json-api.version>1.0</json-api.version>
-        <kafka.version>0.11.0.0</kafka.version>
+        <kafka.version>1.1.1</kafka.version>
         <karaf.version>4.1.4</karaf.version>
         <kibana.version>3.1.1</kibana.version>
         <kibana4.version>4.1.2</kibana4.version>


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Upgrade to Kafka 1.1.x
> ----------------------
>
>                 Key: KARAF-5659
>                 URL: https://issues.apache.org/jira/browse/KARAF-5659
>             Project: Karaf
>          Issue Type: Dependency upgrade
>          Components: decanter
>            Reporter: Jean-Baptiste Onofré
>            Assignee: Jean-Baptiste Onofré
>            Priority: Major
>             Fix For: decanter-2.1.0
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message