<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kuthumi Pepple</title>
    <description>The latest articles on DEV Community by Kuthumi Pepple (@kuthumipepple).</description>
    <link>https://dev.to/kuthumipepple</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F301737%2Fcdc72938-17f0-4e68-90b9-366083e76117.jpg</url>
      <title>DEV Community: Kuthumi Pepple</title>
      <link>https://dev.to/kuthumipepple</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kuthumipepple"/>
    <language>en</language>
    <item>
      <title>Authenticating Camel K to Kafka using SASL</title>
      <dc:creator>Kuthumi Pepple</dc:creator>
      <pubDate>Thu, 04 Aug 2022 01:39:00 +0000</pubDate>
      <link>https://dev.to/kuthumipepple/authenticating-camel-k-to-kafka-using-sasl-1723</link>
      <guid>https://dev.to/kuthumipepple/authenticating-camel-k-to-kafka-using-sasl-1723</guid>
      <description>&lt;p&gt;Apache Camel K is a lightweight integration framework built from Apache Camel that runs natively on Kubernetes and is specifically designed for serverless and microservice architectures. Often referred to as the Swiss army knife for solving integration problems, it can be used to easily integrate many heterogeneous systems and applications allowing them share data seamlessly. Camel K users can instantly run integration code written in &lt;a href="https://camel.apache.org/manual/dsl.html"&gt;Camel DSL&lt;/a&gt; on their preferred cloud (Kubernetes or OpenShift). To learn more about Camel K and Camel, visit the &lt;a href="https://camel.apache.org/"&gt;official Camel site&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Apache_Kafka"&gt;Kafka&lt;/a&gt; can be easily integrated with the rest of your applications using Camel K. Kafka brokers support client authentication using &lt;a href="https://en.wikipedia.org/wiki/Simple_Authentication_and_Security_Layer"&gt;SASL&lt;/a&gt; (Simple Authentication and Security Layer). SASL decouples authentication mechanisms from application protocols thus allowing us to use any of the authentication mechanisms supported by SASL. We will use the SASL supported OAUTHBEARER mechanism for authentication and SSL will handle the data encryption.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;p&gt;This demonstration requires access to a kubernetes/openshift cluster.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing Camel K and required CLI tools
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Camel K&lt;/code&gt;: Follow the &lt;a href="https://camel.apache.org/camel-k/latest/installation/installation.html"&gt;Camel K installation guide&lt;/a&gt; for your specific cluster&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;kamel&lt;/code&gt;: the Apache Camel K CLI tool. Can be downloaded from the &lt;a href="https://github.com/apache/camel-k/releases"&gt;Camel K releases page&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;kubectl&lt;/code&gt;: the kubernetes default CLI tool. Can be downloaded from the &lt;a href="https://github.com/kubernetes/kubernetes/releases"&gt;Kubernetes releases page&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Setting up the Kafka instance
&lt;/h3&gt;

&lt;p&gt;Using Openshift Streams for Apache Kafka, we can easily create a Kafka instance, a service account and a Kafka Topic. The SASL OAUTHBEARER authentication method should be selected. For this demonstration, we are going to name the Kafka Topic "test". Save the Kafka broker URL, service account ID, service account secret and token endpoint URL. We will use them in a configuration file.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using Kafka in a Camel K integration
&lt;/h3&gt;

&lt;p&gt;We will create the following files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;application.properties&lt;/code&gt;: Configuration file, holds configuration properties&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SaslSSLKafkaProducer.java&lt;/code&gt;: Producer, contains integration code and produces to the Kafka Topic&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SaslSSLKafkaConsumer.java&lt;/code&gt;: Consumer, contains integration code and consumes from the Kafka Topic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Kafka uses the Java Authentication and Authorization Service (&lt;a href="https://docs.oracle.com/en/java/javase/13/security/java-authentication-and-authorization-service-jaas1.html"&gt;JAAS&lt;/a&gt;) for SASL configuration, hence we will specify the JAAS configuration in the &lt;code&gt;application.properties&lt;/code&gt; config file. We also have to specify a login callback handler that will retrieve the oauthbearer token.&lt;/p&gt;

&lt;p&gt;application.properties file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Kafka config
camel.component.kafka.brokers = &amp;lt;YOUR KAFKA BROKER URL&amp;gt;
camel.component.kafka.security-protocol = SASL_SSL

camel.component.kafka.sasl-mechanism = OAUTHBEARER
camel.component.kafka.sasl-jaas-config = org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required \
        oauth.client.id='&amp;lt;YOUR SERVICE ACCOUNT ID&amp;gt;' \
        oauth.client.secret='&amp;lt;YOUR SERVICE ACCOUNT SECRET&amp;gt;' \
        oauth.token.endpoint.uri="&amp;lt;TOKEN ENDPOINT URL&amp;gt;" ;
camel.component.kafka.additional-properties[sasl.login.callback.handler.class] = io.strimzi.kafka.oauth.client.JaasClientOauthLoginCallbackHandler

consumer.topic=test
producer.topic=test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the integration files, we will specify &lt;code&gt;kafka-oauth-client&lt;/code&gt; as a maven dependency because it provides the login handler class specified in the configuration file.&lt;/p&gt;

&lt;p&gt;SaslSSLKafkaProducer.java:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="c1"&gt;// camel-k: language=java dependency=mvn:org.apache.camel.quarkus:camel-quarkus-kafka dependency=mvn:io.strimzi:kafka-oauth-client:0.10.0&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.apache.camel.builder.RouteBuilder&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SaslSSLKafkaProducer&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;RouteBuilder&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="nd"&gt;@Override&lt;/span&gt;
  &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;configure&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="kd"&gt;throws&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;info&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"About to start route: Timer -&amp;gt; Kafka "&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;from&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"timer:foo"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;routeId&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"FromTimer2Kafka"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;setBody&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
            &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;simple&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Message #${exchangeProperty.CamelTimerCounter}"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;to&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"kafka:{{producer.topic}}"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;log&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Message correctly sent to the topic!"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;SaslSSLKafkaConsumer.java:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="c1"&gt;// camel-k: language=java dependency=mvn:org.apache.camel.quarkus:camel-quarkus-kafka dependency=mvn:io.strimzi:kafka-oauth-client:0.10.0&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.apache.camel.builder.RouteBuilder&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SaslSSLKafkaConsumer&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;RouteBuilder&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="nd"&gt;@Override&lt;/span&gt;
  &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;configure&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="kd"&gt;throws&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;info&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"About to start route: Kafka -&amp;gt; Log "&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;from&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"kafka:{{consumer.topic}}"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;routeId&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"FromKafka2Log"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;log&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"${body}"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Bundle configuration properties into a secret:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl create secret generic kafka-props --from-file application.properties
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Producing to the Kafka Topic
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kamel run --config secret:kafka-props SaslSSLKafkaProducer.java --dev
...
[2] 2021-05-06 08:48:11,854 INFO  [FromTimer2Kafka] (Camel (camel-1) thread #1 - KafkaProducer[test]) Message correctly sent to the topic!
[2] 2021-05-06 08:48:11,854 INFO  [FromTimer2Kafka] (Camel (camel-1) thread #3 - KafkaProducer[test]) Message correctly sent to the topic!
[2] 2021-05-06 08:48:11,973 INFO  [FromTimer2Kafka] (Camel (camel-1) thread #5 - KafkaProducer[test]) Message correctly sent to the topic!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Consuming from the Kafka Topic
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kamel run --config secret:kafka-props SaslSSLKafkaConsumer.java --dev
...
[1] 2021-05-06 08:51:08,991 INFO  [FromKafka2Log] (Camel (camel-1) thread #0 - KafkaConsumer[test]) Message #8
[1] 2021-05-06 08:51:10,065 INFO  [FromKafka2Log] (Camel (camel-1) thread #0 - KafkaConsumer[test]) Message #9
[1] 2021-05-06 08:51:10,991 INFO  [FromKafka2Log] (Camel (camel-1) thread #0 - KafkaConsumer[test]) Message #10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;That's it! Hopefully someone finds this useful and if you have any questions or comments, feel free to post in the comments section. Happy Coding!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>camelk</category>
      <category>kafka</category>
      <category>sasl</category>
      <category>camel</category>
    </item>
    <item>
      <title>Outreachy Blog #1: Introduce Yourself</title>
      <dc:creator>Kuthumi Pepple</dc:creator>
      <pubDate>Mon, 06 Jun 2022 09:05:40 +0000</pubDate>
      <link>https://dev.to/kuthumipepple/outreach-blog-1-introduce-yourself-475h</link>
      <guid>https://dev.to/kuthumipepple/outreach-blog-1-introduce-yourself-475h</guid>
      <description>&lt;p&gt;I'm Kuthumi Pepple, I studied Computer Science at Obafemi Awolowo University, Nigeria. I'm a firm believer in the power of technology to improve lives. I like coding, gaming and learning about new technologies. Recently, I've bought into the ideas of the open-source movement and enjoy making contributions to open-source projects. I'm currently an Outreachy intern in Apache (more about this below)&lt;/p&gt;

&lt;h2&gt;
  
  
  My Core Values
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Competence
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Anything worth doing is worth doing well&lt;/em&gt; (Philip Stanhope) &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I try my best to uphold this standard in every area of my life, especially in my career as a software developer where incompetence can be costly either in the present or future. I try never to submit work that I've judged to be subpar.&lt;/p&gt;

&lt;h3&gt;
  
  
  Contribution
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Measure your life not by its duration but by its contribution&lt;/em&gt; (Peter Marshall)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is important to me for several reasons. Firstly, making contributions helps others and makes the world a better place. Secondly, there is a gratifying feeling that comes with making contributions to either a project, community or cause. Finally, it is my way of giving back. Given that I've benefited from the contributions of others, whether its free online learning resources, free software or a mentor showing me a thing or two, it's only right that I make contributions that benefit others as well.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pleasure
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;I finally figured out that the only reason to be alive is to enjoy it&lt;/em&gt; (Rita Mae Brown)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I don't believe in the afterlife, so I try to experience all the happiness that this life has to offer. I try to have fun or at the very least derive some mental satisfaction in most things I choose to do. Life is too short to spend it on things that are non-stimulating.&lt;/p&gt;

&lt;h2&gt;
  
  
  What motivated me to apply to Outreachy
&lt;/h2&gt;

&lt;p&gt;I've always wanted to make some impact as a software developer so when I first learned about the Outreachy Internship Program, I applied in a heartbeat. Outreachy provides paid internships in open source to underrepresented groups in the tech industry (find out more &lt;a href="https://www.outreachy.org/"&gt;here&lt;/a&gt;). Although I wasn't successful in my first attempt, I got some valuable experience which led to me being successful in a subsequent attempt.&lt;/p&gt;

</description>
      <category>outreachy</category>
      <category>internship</category>
    </item>
  </channel>
</rss>
