<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Tatarao voleti on Medium]]></title>
        <description><![CDATA[Stories by Tatarao voleti on Medium]]></description>
        <link>https://medium.com/@tatarao?source=rss-998f0f49133f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ZhahnXnbh_yhpIopxFbFfw.jpeg</url>
            <title>Stories by Tatarao voleti on Medium</title>
            <link>https://medium.com/@tatarao?source=rss-998f0f49133f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 16:04:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tatarao/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Spring Kafka - Publish messages to Topic & Consume messages from topic]]></title>
            <link>https://medium.com/enterprise-java/spring-kafka-publish-messages-to-topic-consume-messages-from-topic-2905873dd107?source=rss-998f0f49133f------2</link>
            <guid isPermaLink="false">https://medium.com/p/2905873dd107</guid>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[spring-kafka]]></category>
            <dc:creator><![CDATA[Tatarao voleti]]></dc:creator>
            <pubDate>Sun, 30 Jan 2022 13:40:19 GMT</pubDate>
            <atom:updated>2022-03-13T17:04:28.590Z</atom:updated>
            <content:encoded><![CDATA[<h4>Spring Kafka project provides an abstraction layer on core apache Kafka libraries.</h4><p>To simplify the development time, spring team has created Spring for apache Kafka on top of core apache Kafka libraries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qHrDsMxoGMrYd-8eSxBBsQ.png" /><figcaption>Spring boot — Apache Kafka</figcaption></figure><p>It provides a “<strong>KafkaTemplate</strong>” as a high-level abstraction for sending messages. It also provides support for Message-driven POJOs with @KafkaListener annotations and a “listener container”.</p><p>Create a spring boot project using spring initializer — <a href="https://start.spring.io/">https://start.spring.io/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7CBePlW8X4n3FkDn7U1AQw.png" /></figure><p>We choose Gradle as build management system instead of Maven.</p><p>In order to add Kafka support to spring boot application, we need Spring for Apache Kafka dependency.</p><p>Spring web dependency is added to enable MVC support. So that we can write basic REST endpoint and then publish the messages using KafkaTemplate.</p><p>lombok dependency to avoid writing boiler plate code such as getters, setters, toString, etc…</p><p>Choose the packaging type as Jar and java version as java8 .</p><p>Generate the project. Generated project would be downloaded to our local machine. Extract the zip and import into Eclipse or Intellij.</p><p>We are done with project structure setup. Now it’s the time to create Producer configuration and Consumer configuration.</p><h3><strong>Producer Configuration</strong></h3><p>KafkaProducerConfig.java</p><pre>package com.kafka.poc.producer.config;</pre><pre>import java.util.HashMap;<br>import java.util.Map;</pre><pre>import org.apache.kafka.clients.producer.ProducerConfig;<br>import org.apache.kafka.common.serialization.StringSerializer;<br>import org.springframework.context.annotation.Bean;<br>import org.springframework.context.annotation.Configuration;<br>import org.springframework.kafka.core.DefaultKafkaProducerFactory;<br>import org.springframework.kafka.core.KafkaTemplate;<br>import org.springframework.kafka.core.ProducerFactory;</pre><pre><a href="http://twitter.com/Configuration">@Configuration</a><br>public class KafkaProducerConfig {</pre><pre><a href="http://twitter.com/Bean">@Bean</a><br> public ProducerFactory&lt;String, String&gt; producerFactory() {<br>  Map&lt;String, Object&gt; configProps = new HashMap&lt;&gt;();<br>  configProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,           &quot;127.0.0.1:9092&quot;);<br>  configProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);<br>  configProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class);<br>  return new DefaultKafkaProducerFactory&lt;&gt;(configProps);<br> }<br> <br> <a href="http://twitter.com/Bean">@Bean</a><br> public KafkaTemplate&lt;String, String&gt; kafkaTemplate() {<br>  return new KafkaTemplate&lt;&gt;(producerFactory());<br> }<br>}</pre><p>To consume messages from Kafka topic we need a Kafka consumer. In order to that first we need to create consumer configuration setup. Here is the place we create ConcurrentKafkaListenerContainerFactory.</p><h3>Consumer configuration</h3><p>KafkaConsumerConfig.java</p><pre>`package com.kafka.poc.consumer.config;</pre><pre>import java.util.HashMap;<br>import java.util.Map;</pre><pre>import org.apache.kafka.clients.consumer.ConsumerConfig;<br>import org.apache.kafka.common.serialization.StringDeserializer;<br>import org.springframework.context.annotation.Bean;<br>import org.springframework.context.annotation.Configuration;<br>import org.springframework.kafka.annotation.EnableKafka;<br>import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;<br>import org.springframework.kafka.core.ConsumerFactory;<br>import org.springframework.kafka.core.DefaultKafkaConsumerFactory;<br>import org.springframework.kafka.listener.BatchLoggingErrorHandler;<br>import org.springframework.kafka.listener.ContainerProperties.AckMode;</pre><pre><a href="http://twitter.com/EnableKafka">@EnableKafka</a><br><a href="http://twitter.com/Configuration">@Configuration</a><br>public class KafkaConsumerConfig {</pre><pre><a href="http://twitter.com/Bean">@Bean</a><br> public ConsumerFactory&lt;String, String&gt; consumerFactory() {<br>  Map&lt;String, Object&gt; props = new HashMap&lt;&gt;();<br>  props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, &quot;127.0.0.1:9092&quot;);<br>  props.put(ConsumerConfig.GROUP_ID_CONFIG, &quot;batch-id&quot;);<br>  props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);<br>  props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);<br>     props.put(ConsumerConfig.MAX_POLL_RECORDS_CONFIG, &quot;50&quot;);<br>  return new DefaultKafkaConsumerFactory&lt;&gt;(props);<br> }</pre><pre><a href="http://twitter.com/Bean">@Bean</a><br> public ConcurrentKafkaListenerContainerFactory&lt;String, String&gt; kafkaListenerContainerFactory() {<br>  ConcurrentKafkaListenerContainerFactory&lt;String, String&gt; factory = new ConcurrentKafkaListenerContainerFactory&lt;&gt;();<br>  factory.setConsumerFactory(consumerFactory());<br>  factory.getContainerProperties().setAckMode(AckMode.MANUAL);<br>  factory.setBatchListener(true);<br>  factory.setBatchErrorHandler(new BatchLoggingErrorHandler());<br>  return factory;<br> }<br>}</pre><h4>Create ConsumerFactory with</h4><ol><li>Kafka bootstrap server address.</li><li>key serializer and value serializer. These are to serialize/deserialize key and values.</li></ol><h4>Register ConcurrentKafkaListenerContainerFactory</h4><p>ConcurrentKafkaListenerContainerFactory is used to create containers for annotated methods with @KafkaListener</p><p>There are two MessageListenerContainer in spring Kafka</p><pre>KafkaMessageListenerContainer, ConcurrentMessageListenerContainer</pre><blockquote><em>The </em><em>KafkaMessageListenerContainer receives all message from all topics or partitions on a single thread. The </em><em>ConcurrentMessageListenerContainer delegates to one or more </em><em>KafkaMessageListenerContainer instances to provide multi-threaded consumption.</em></blockquote><ol><li>factory.setBatchListener(true) — Enabled batch processing and acknowledge as manual.</li><li>Acknowledgement mode is Manual — meaning consumer needs to manually commit offset.</li></ol><h3>Message Listener/ Kafka consumer</h3><p>Finally we would create message listener class to consume message from “review” topic.</p><h4>ConsumerProcess.java</h4><pre>package com.kafka.poc.consumer.app;</pre><pre>import java.util.List;<br>import java.util.stream.Collectors;</pre><pre>import org.springframework.context.annotation.Configuration;<br>import org.springframework.kafka.annotation.KafkaListener;<br>import org.springframework.kafka.support.Acknowledgment;<br>import org.springframework.messaging.handler.annotation.SendTo;</pre><pre>import com.fasterxml.jackson.core.JsonProcessingException;<br>import com.fasterxml.jackson.databind.ObjectMapper;</pre><pre>import lombok.extern.slf4j.Slf4j;</pre><pre><a href="http://twitter.com/Slf4j">@Slf4j</a><br><a href="http://twitter.com/Configuration">@Configuration</a><br>public class ConsumerProcessor {<br> <br> private ObjectMapper mapper = new ObjectMapper();</pre><pre><a href="http://twitter.com/KafkaListener">@KafkaListener</a>(topics = &quot;review&quot;, groupId = &quot;batch-id&quot;, containerFactory = &quot;kafkaListenerContainerFactory&quot;)<br> public void listen(List&lt;String&gt; reviews, Acknowledgment ack) {<br>  log.info(&quot;Received review size {}&quot;, reviews.size());<br>  try {<br>   List&lt;Track&gt; trackList = reviews.stream().map(this::deserialize)<br>     .collect(Collectors.toList());<br>   log.info(&quot;Converted into track domain objects , total size {}&quot;, trackList.size());<br>  } finally {<br>   log.info(&quot;acknowledge&quot;);<br>   ack.acknowledge();<br>  }<br> }</pre><pre>private Track deserialize(String review) {<br>  try {<br>   return mapper.readValue(review, Track.class);<br>  } catch (JsonProcessingException e) {<br>   e.printStackTrace();<br>  }<br>  return null;<br> }<br>}</pre><blockquote>@KafkaListener annotation added on listener class method will take care of consuming messages from the topic.</blockquote><h4>Producer and consumer configuration are enough to bring up Spring Kafka service since we have created both producer and consumer in same service.</h4><p>Next step is to produce messages in to Kafka topic.</p><p>To do this we would create a REST api and it created Track object and publishes to “review” Kafka topic.</p><p>To publish a message from REST api , we need KafkaTemplate. So inject KafkaTemplate bean in Controller class.</p><pre><a href="http://twitter.com/Autowired">@Autowired</a><br>public KafkaTemplate&lt;String, String&gt; kafkaTemplate;</pre><p>Key and Value types for KakfaTemplate are of type String here.</p><h3>Create a REST API</h3><p>ReviewController.java</p><pre>package com.kafka.poc.producer.app;</pre><pre>import org.springframework.beans.factory.annotation.Autowired;<br>import org.springframework.http.ResponseEntity;<br>import org.springframework.kafka.core.KafkaTemplate;<br>import org.springframework.kafka.support.SendResult;<br>import org.springframework.util.concurrent.ListenableFuture;<br>import org.springframework.util.concurrent.ListenableFutureCallback;<br>import org.springframework.web.bind.annotation.PostMapping;<br>import org.springframework.web.bind.annotation.RequestParam;<br>import org.springframework.web.bind.annotation.RestController;</pre><pre>import lombok.extern.slf4j.Slf4j;</pre><pre><a href="http://twitter.com/Slf4j">@Slf4j</a><br><a href="http://twitter.com/RestController">@RestController</a><br>public class ReviewController {</pre><pre><a href="http://twitter.com/Autowired"> @Autowired</a><br> public KafkaTemplate&lt;String, String&gt; kafkaTemplate;</pre><pre> private ObjectMapper mapper = new ObjectMapper();<br> <br> <a href="http://twitter.com/GetMapping">@PostMapping</a>(&quot;/message&quot;)<br> public ResponseEntity&lt;Object&gt; publish() {</pre><pre>   Track track = Track.builder().soruce(&quot;mobile&quot;)<br>    .event(&quot;REVIEW-&quot; + a).status(&quot;REVIEWOK&quot;)<br>     .trackId(UUID.randomUUID().toString())<br>     .updatedTime(LocalDate.now()).build();</pre><pre>   try {<br>    String request = mapper.writeValueAsString(track);<br>    kafkaTemplate.send(&quot;review&quot;, msg);</pre><pre>   } catch (JsonProcessingException e) {}  <br>  <br>  return ResponseEntity.ok().build();<br> }<br> <br>}</pre><p>We are constructing Track object and converting into string and then publishing to “review” topic.</p><p>Here is the Track class, we would use lombok to create getters, setters, builder pattern. This is to avoid boiler plate code.</p><pre>package com.kafka.poc.producer.app;</pre><pre>import java.time.LocalDate;</pre><pre>import com.fasterxml.jackson.databind.annotation.JsonDeserialize;<br>import com.fasterxml.jackson.databind.annotation.JsonSerialize;<br>import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;<br>import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;</pre><pre>import lombok.AllArgsConstructor;<br>import lombok.Builder;<br>import lombok.Data;<br>import lombok.NoArgsConstructor;</pre><pre><a href="http://twitter.com/NoArgsConstructor">@NoArgsConstructor</a><br><a href="http://twitter.com/AllArgsConstructor">@AllArgsConstructor</a><br><a href="http://twitter.com/Data">@Data</a><br><a href="http://twitter.com/Builder">@Builder</a><br>public class Track {</pre><pre>private String status;<br> private String trackDesc;<br> private String soruce;<br> private String event;<br> private String trackId;<br> <br> <a href="http://twitter.com/JsonDeserialize">@JsonDeserialize</a>(using = LocalDateDeserializer.class)  <br> <a href="http://twitter.com/JsonSerialize">@JsonSerialize</a>(using = LocalDateSerializer.class)  <br> private LocalDate updatedTime;<br> <br>}`</pre><p>Now we will create a “review” topic. To do that first we need to bring up Kafka in our local. So we first start Zookeeper and then Kafka Server.</p><blockquote>If you don&#39;t have Kafka installed in local then fallow this tutorial.</blockquote><h4>Create Kafka topic from command line.</h4><p>Go to bin directory for Apache Kafka distribution on your local and execute below command.</p><pre>kafka-topics.bat --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic review</pre><p>Now start the service and hit the REST endpoint to publish messages. If we observe that published messages are consumed by Kafka consumer and it gets printed in Intellij/eclipse console.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2905873dd107" width="1" height="1" alt=""><hr><p><a href="https://medium.com/enterprise-java/spring-kafka-publish-messages-to-topic-consume-messages-from-topic-2905873dd107">Spring Kafka - Publish messages to Topic &amp; Consume messages from topic</a> was originally published in <a href="https://medium.com/enterprise-java">Spring eco system</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MySQL ON DUPLICATE KEY]]></title>
            <link>https://medium.com/@tatarao/mysql-on-duplicate-key-1c3f6b047a54?source=rss-998f0f49133f------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c3f6b047a54</guid>
            <category><![CDATA[mysql]]></category>
            <dc:creator><![CDATA[Tatarao voleti]]></dc:creator>
            <pubDate>Sun, 30 Jan 2022 10:31:15 GMT</pubDate>
            <atom:updated>2022-01-30T10:31:15.422Z</atom:updated>
            <content:encoded><![CDATA[<p>In SQL Server database we have if not exists(condition)</p><p>But in MySQL Database we don’t have this type of command. But we can achieve this concept by using ON DUPLICATE KEY.</p><p>what this will do is, it checks the record in tables based on id. Basically those are unique or primary Key. If record is not there it will insert new record otherwise it updates the existing record.</p><blockquote>This exactly like what we have saveOrUpdate() in Hibernate.</blockquote><p>create table in MySQL Database</p><pre>CREATE TABLE `emp_address` ( `city` varchar(50) NOT NULL, `street` varchar(10) NOT NULL, `dist` varchar(20) NOT NULL, `country` varchar(20) NOT NULL, `id` int(10) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c3f6b047a54" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[lastIndexOf using JSTL]]></title>
            <link>https://medium.com/@tatarao/lastindexof-using-jstl-655d3d200c2c?source=rss-998f0f49133f------2</link>
            <guid isPermaLink="false">https://medium.com/p/655d3d200c2c</guid>
            <category><![CDATA[jstl]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Tatarao voleti]]></dc:creator>
            <pubDate>Sun, 30 Jan 2022 10:11:50 GMT</pubDate>
            <atom:updated>2022-01-30T10:11:50.545Z</atom:updated>
            <content:encoded><![CDATA[<h4>Article to use lastIndexOf method in JSTL</h4><p>In java if we want to get a word based on last separator from a string, we need to go for lastIndexOf() method which is available in String class.</p><p>Here is the code snippet to extract last word from a given string using delimiter “:”</p><pre>String stringPattern=&quot;java:is:opensource&quot;; </pre><pre>System.out.println(stringPattern.substring(<br>stringPattern.lastIndexOf(&quot;:&quot;)+1,stringPattern.length()<br>));</pre><pre>Output: opensource</pre><p>We can achieve same through JSTL. To do that we have to fallow array concept because JSTL doesn’t provide lastIndexOf method like JAVA String class.</p><pre>&lt;c:set value=&quot;${fn:split(&#39;java:is:opensource&#39;,&#39;:&#39;)}&quot; var=&quot;separatorPosition&quot; /&gt;</pre><pre>&lt;c:out value=&quot;${separatorPosition[fn:length(separatorPosition)-1]}&quot;&gt; &lt;/c:out&gt;</pre><p>Output will be ‘opensource’.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=655d3d200c2c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Generate Spring Boot project with Spring Initializr]]></title>
            <link>https://medium.com/enterprise-java/generate-spring-boot-project-with-spring-initializr-9453c30a3922?source=rss-998f0f49133f------2</link>
            <guid isPermaLink="false">https://medium.com/p/9453c30a3922</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[microservices]]></category>
            <dc:creator><![CDATA[Tatarao voleti]]></dc:creator>
            <pubDate>Sun, 02 Aug 2020 12:18:19 GMT</pubDate>
            <atom:updated>2021-03-14T06:41:22.168Z</atom:updated>
            <content:encoded><![CDATA[<h3>Spring Boot Micro service — Part 1</h3><p>Spring boot is full-stack application development framework. We can create Web based enterprise applications, Micro services and Standalone applications.</p><blockquote>Spring boot framework is well known for creating production ready Micro services.</blockquote><p>In this post , we will learn about how to create Spring boot project structure with <strong>Spring</strong> <strong>Initializr</strong></p><blockquote><strong>Spring</strong> <strong>Initializr</strong> is a web based tool/project created by Pivotal which lets developers to create the structure of the Spring Boot Application.</blockquote><p>It reduces developer’s time, so developer’s can concentrate on adding additional dependencies and writing code.</p><h4>There are multiple ways to create Spring boot project structure.</h4><blockquote>Using Spring <strong>Initializr</strong></blockquote><blockquote>Using Spring Tool Suite.</blockquote><h4>In this tutorial , we create project structure by using web based tool.</h4><p>Go to <strong>https://start.spring.io/ </strong>and<strong> </strong>Choose</p><ol><li>Project type (Maven or Gradle)</li><li>Spring Boot version,</li><li>Packaging type (jar or War)</li><li>Add required dependencies (Web , devtools, actuator etc)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PMeUcV6T6np0XUnZ5JZKng.png" /></figure><blockquote>Once we click on Generate button , tool will generate <strong>zip</strong> file and gets downloaded into our machine.</blockquote><blockquote>Extract the zip file and import the project into you favorite IDE (STS, Intellij), for this tutorial i m using intellij. Once you import project we will see this structure.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*1Un590t8C1aLNAmplDWXTg.png" /></figure><blockquote>Below is the pom.xml file it contains various starter dependencies like spring-boot-starter-web, sprint-boot-starter-actuator.</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dcb52b8fa1d92a4bd48e607919a8f0e1/href">https://medium.com/media/dcb52b8fa1d92a4bd48e607919a8f0e1/href</a></iframe><blockquote>As we included spring-boot-starter-web dependency it contains embedded tomcat server.</blockquote><p>Next we will create application startup class.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4011f0f42551c7d7a9e22903bdd07c1b/href">https://medium.com/media/4011f0f42551c7d7a9e22903bdd07c1b/href</a></iframe><blockquote>Next we will create rest api with endpoint as /wish for that we need a controller class. This endpoint returns hello world message back to client.</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8aa92b4f2c97235fccbda7100b8b3a74/href">https://medium.com/media/8aa92b4f2c97235fccbda7100b8b3a74/href</a></iframe><blockquote>Next will expose actuator endpoints, so that we can check heath status of our micro service. For this we need to include actuator starter dependency in pom.xml. Now we /actuator/info, /actuator/health and others gets available.</blockquote><p>Now we do some logging and expose actuator endpoints , for this we do fallowing configuration in application.properties</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/818589d5d889778c62bad5a220da68ea/href">https://medium.com/media/818589d5d889778c62bad5a220da68ea/href</a></iframe><p>Run this application as java application. It runs at default port number 8080. Now we test this /wish and /actuator/health endpoints.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xdiji6JscQwrHd563pYUMg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*8685UTo_oeznxPEhIbc-FA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*386vt2GlEmBNwFYDCn9A6g.png" /></figure><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9453c30a3922" width="1" height="1" alt=""><hr><p><a href="https://medium.com/enterprise-java/generate-spring-boot-project-with-spring-initializr-9453c30a3922">Generate Spring Boot project with Spring Initializr</a> was originally published in <a href="https://medium.com/enterprise-java">Spring eco system</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to send Mail using Java Mail API]]></title>
            <link>https://medium.com/enterprise-java/how-to-send-mail-using-java-mail-api-58a5a4191daf?source=rss-998f0f49133f------2</link>
            <guid isPermaLink="false">https://medium.com/p/58a5a4191daf</guid>
            <category><![CDATA[mail]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[gmail]]></category>
            <category><![CDATA[email]]></category>
            <dc:creator><![CDATA[Tatarao voleti]]></dc:creator>
            <pubDate>Tue, 27 Nov 2018 15:51:14 GMT</pubDate>
            <atom:updated>2020-08-02T12:24:22.278Z</atom:updated>
            <content:encoded><![CDATA[<p>In this tutorial we are going to explore, how to send email using java Api.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GoV-kgs2EnwR0Qxe" /><figcaption>Photo by <a href="https://unsplash.com/@austindistel?utm_source=medium&amp;utm_medium=referral">Austin Distel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>By using java mail API we can send e-mails to any valid recipient. In this article we are going to use Gmail SMTP to send mails.</p><blockquote>So we need configure gmail username and password in java application.</blockquote><blockquote>In order to make use of this application it is required to add <strong>mail.jar</strong> in class-path of your application.</blockquote><p>Since Gmail is so secured , we cannot easily send emails using java with Gmail credentials.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Pzi3wl9QpHzpgsTA" /><figcaption>Photo by <a href="https://unsplash.com/@michaelmroczek?utm_source=medium&amp;utm_medium=referral">Michael Mroczek</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>To make use of Gmail SMTP, first we need to allow untrusted applications access in Gmail settings. Otherwise Gmail won’t allow our java program to make use of it’s SMTP server.</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4d657752e00252335dfacce799b1cfeb/href">https://medium.com/media/4d657752e00252335dfacce799b1cfeb/href</a></iframe><p><a href="https://medium.com/enterprise-java/upload-file-with-java-zoom-api-301115be5ed4">Upload file with Java zoom API</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58a5a4191daf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/enterprise-java/how-to-send-mail-using-java-mail-api-58a5a4191daf">How to send Mail using Java Mail API</a> was originally published in <a href="https://medium.com/enterprise-java">Spring eco system</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Generate JAXB Classes from XSD by using XJC]]></title>
            <link>https://medium.com/enterprise-java/generate-jaxb-classes-from-xsd-by-using-xjc-93779264823c?source=rss-998f0f49133f------2</link>
            <guid isPermaLink="false">https://medium.com/p/93779264823c</guid>
            <category><![CDATA[dx]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[web-services]]></category>
            <dc:creator><![CDATA[Tatarao voleti]]></dc:creator>
            <pubDate>Wed, 09 Dec 2015 00:00:00 GMT</pubDate>
            <atom:updated>2020-05-26T07:58:57.754Z</atom:updated>
            <content:encoded><![CDATA[<h3>Generate JAXB Classes from XSD</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Y1lVPMyZjxQEmVkF" /><figcaption>Photo by <a href="https://unsplash.com/@scw1217?utm_source=medium&amp;utm_medium=referral">Suzanne D. Williams</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>By Using <strong>XJC </strong>tool which is given by <strong>JDK </strong>we can generate <strong>JAXB </strong>Classes from <strong>xsd </strong>file .This tool by default comes up with JDK installation.</blockquote><p>If we want to generate <strong>jaxb </strong>classes from any <strong>xsd</strong>, Go to Command prompt and execute fallowing command.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d681ffafade09364745d910202b67d9b/href">https://medium.com/media/d681ffafade09364745d910202b67d9b/href</a></iframe><ul><li><strong>p</strong> denotes target package where <strong>jaxb </strong>classes has to be generated.</li><li><strong>-d</strong> denotes Java source files directory location.</li></ul><h3>Tatarao voleti on Twitter</h3><p>Generate JAXB Classes from XSD https://t.co/3kbESymtBs</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93779264823c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/enterprise-java/generate-jaxb-classes-from-xsd-by-using-xjc-93779264823c">Generate JAXB Classes from XSD by using XJC</a> was originally published in <a href="https://medium.com/enterprise-java">Spring eco system</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Configure SSL Certificate in Tomcat]]></title>
            <link>https://medium.com/enterprise-java/ssl-certificate-configuration-in-tomcat-7-ec8196741798?source=rss-998f0f49133f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec8196741798</guid>
            <category><![CDATA[ssl]]></category>
            <category><![CDATA[tomcat]]></category>
            <dc:creator><![CDATA[Tatarao voleti]]></dc:creator>
            <pubDate>Wed, 29 Oct 2014 00:00:00 GMT</pubDate>
            <atom:updated>2019-04-13T11:44:14.784Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-eEY9Xk3uzYlpSXq" /><figcaption>Photo by <a href="https://unsplash.com/@dream_emulator?utm_source=medium&amp;utm_medium=referral">Sebastiaan Hols</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>SSL </strong>Stands for Secure Socket Layer. In web <strong>SSL </strong>certificates plays Key role while passing sensitive information to the server ie, username, password,credit card details etc.</p><p>In order to configure SSL Certificate in web or application server , we need to purchase SSL Certificate from <strong>CA’s</strong> (Certificate Authorities) .</p><p>But we can create dummy SSL certificates for development purpose by using a tool given by java called , that tool name is <strong>keytool</strong> , it comes along with Java installation.</p><h3><strong>Procedure to create SSL Certificate:</strong></h3><p>Set java path in environment variables, so that we can use <strong>keytool </strong>command in any where. Open command prompt and type</p><pre>keytool -genkey -alias tomcat -keyalg RSA -keystore mycert.cert</pre><p>It will ask several questions like Enter keystore password, Organizational unite and etc. Enter all the details. It creates mycert.cert SSL file in home directory.</p><h4><strong>Add Created Self Signed Certificate to Tomcat 7</strong></h4><blockquote><em>Go to Tomcat installation installation directory and navigate to conf folder , open server.xml and try to find below code.</em></blockquote><pre>&lt;Connector port=&quot;8443&quot; protocol=&quot;HTTP/1.1&quot; SSLEnabled=&quot;true&quot; maxThreads=&quot;150&quot; scheme=&quot;https&quot; secure=&quot;true&quot; clientAuth=&quot;false&quot; sslProtocol=&quot;TLS&quot; /&gt;</pre><blockquote><em>Above code is commented by default in server.xml , we need to un comment that code and add created SSL certificate details.</em></blockquote><pre>&lt;Connector port=&quot;8443&quot; protocol=&quot;HTTP/1.1&quot; SSLEnabled=&quot;true&quot; maxThreads=&quot;150&quot; scheme=&quot;https&quot; secure=&quot;true&quot; keystoreFile=&quot;C:\mycert.cert&quot; keystorePass=&quot;your password&quot; clientAuth=&quot;false&quot; sslProtocol=&quot;TLS&quot; /&gt;</pre><p>Restart Tomcat and type this url in browser <a href="https://localhost:8443/"><strong>https://localhost:8443</strong></a>. We can see a lock symbol in address bar preceded by <strong>https</strong></p><p><a href="https://medium.com/enterprise-java/adding-user-in-jboss-app-server-7-final-41f2b0461b73">How to add user in JBoss Application Server</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec8196741798" width="1" height="1" alt=""><hr><p><a href="https://medium.com/enterprise-java/ssl-certificate-configuration-in-tomcat-7-ec8196741798">Configure SSL Certificate in Tomcat</a> was originally published in <a href="https://medium.com/enterprise-java">Spring eco system</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to add user in JBoss Application Server]]></title>
            <link>https://medium.com/enterprise-java/adding-user-in-jboss-app-server-7-final-41f2b0461b73?source=rss-998f0f49133f------2</link>
            <guid isPermaLink="false">https://medium.com/p/41f2b0461b73</guid>
            <category><![CDATA[deploy]]></category>
            <category><![CDATA[java-enterprise]]></category>
            <category><![CDATA[application-server]]></category>
            <category><![CDATA[war]]></category>
            <category><![CDATA[jboss]]></category>
            <dc:creator><![CDATA[Tatarao voleti]]></dc:creator>
            <pubDate>Sat, 25 Oct 2014 13:00:44 GMT</pubDate>
            <atom:updated>2018-12-03T15:52:46.876Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HWdtmtHA9v6BsXG3" /><figcaption>“ Image” by <a href="https://unsplash.com/@kobuagency?utm_source=medium&amp;utm_medium=referral">Kobu Agency</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In JBoss Application server if we want to access administration console we have to add an user first. Then only we can access admin console.</p><p>After installation of JBoss without adding any user , if we try to click on administration link on JBoss welcome page it will show error message like <strong>there are no users</strong>. In order to access admin console of JBoss , we need to create a user first.</p><h4>Here is the step by step procedure to add user.</h4><p>1.Go to JBoss installation folder -&gt; open bin folder -&gt; double click on add- user.bat file where you have to add new user as below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/0*hFNYqlgNQZXfNVZb" /></figure><p>2. Press enter key and start JBoss App Server by double clicking on standalone.bat file in bin folder.</p><p>3. Now open http://localhost:7070/</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/0*2qRqxU5Tjg8XNP7e" /></figure><p>4. Click on Administration link on JBoss Home page. we will get below dialog box asking user name and password of added user.</p><p>We can see port number changing on address bar to 9990 from 7070.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/0*c6OF4MW_32fyr0gz" /></figure><p>5. Enter username and password of added user, we will get fallowing page after login.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/0*dNJkwl4Rh30fAZVZ" /></figure><p>6. Through this page we can upload war file to JBoss server , we can manage connection pooling from here</p><p>7. If we want to upload war file , Click on Manage Deployments Under Deployments of left sidebar.</p><p>8. Click on Add content button. It will display dialog box for uploading war file. By pressing next button we can upload war file to JBoss AS 7</p><p><a href="https://medium.com/enterprise-java/jboss-as-7-1-1-final-tutorial-fc4e69b1e525">Install and run Wildfly application server</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41f2b0461b73" width="1" height="1" alt=""><hr><p><a href="https://medium.com/enterprise-java/adding-user-in-jboss-app-server-7-final-41f2b0461b73">How to add user in JBoss Application Server</a> was originally published in <a href="https://medium.com/enterprise-java">Spring eco system</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JDBC connection pooling with C3P0]]></title>
            <link>https://medium.com/enterprise-java/jdbc-connection-pooling-with-c3p0-fb227fc773f5?source=rss-998f0f49133f------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb227fc773f5</guid>
            <category><![CDATA[jdbc]]></category>
            <category><![CDATA[c3p0]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Tatarao voleti]]></dc:creator>
            <pubDate>Fri, 27 Dec 2013 13:13:03 GMT</pubDate>
            <atom:updated>2018-12-01T11:18:49.656Z</atom:updated>
            <content:encoded><![CDATA[<h3>Manage jdbc connections with C3P0 connection pooling</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JnVVnl4W16DvbxkQ" /><figcaption>Photo by <a href="https://unsplash.com/@halgatewood?utm_source=medium&amp;utm_medium=referral">Hal Gatewood</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>Jdbc Connection pool is factory that contains set of readily available connection objects before actually being used.</blockquote><p>If we want to perform operations on database,first what we have to do is</p><blockquote>Load database driver class into our application by using Class.forName(-) Need to Establish connection with database by using DriverManager.getConnection(-,-,-)</blockquote><p>Prepare statement object for executing query, get result set object and finally we need to close the connection</p><p>These are the repeated steps to interact with the database. Here programmer should take care of connection closing and all.</p><blockquote>On the Other hand , jdbc Connection pool is there. Jdbc Connection pool is factory that contains set of readily available connection objects before actually being used.</blockquote><p>Connection pool often comes up with Application servers. since Application servers like weblogic are heavy weight. so we can use 3rd party connection pools like Apache DBCP, C3P0 or Proxool.</p><blockquote>we can download C3P0 from it’s official website as zip file and then extract that zip file into one directory and then we need to add C3P0-ver.jar to classpath of our application.</blockquote><p>In this Post we are configuring C3P0 connection pool.</p><blockquote><strong>Sample class</strong></blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8ebf24c5ae96ec7668503e2b64788ba7/href">https://medium.com/media/8ebf24c5ae96ec7668503e2b64788ba7/href</a></iframe><blockquote>Now create client application , it will get connection from connection pool</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5c627dacf86bd3b581f63d76b7c8e887/href">https://medium.com/media/5c627dacf86bd3b581f63d76b7c8e887/href</a></iframe><p><a href="https://medium.com/enterprise-java/how-to-send-mail-using-java-mail-api-58a5a4191daf">How to send Mail using Java Mail API</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb227fc773f5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/enterprise-java/jdbc-connection-pooling-with-c3p0-fb227fc773f5">JDBC connection pooling with C3P0</a> was originally published in <a href="https://medium.com/enterprise-java">Spring eco system</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Install and run Wildfly application server]]></title>
            <link>https://medium.com/enterprise-java/jboss-as-7-1-1-final-tutorial-fc4e69b1e525?source=rss-998f0f49133f------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc4e69b1e525</guid>
            <category><![CDATA[wildfly]]></category>
            <category><![CDATA[java-enterprise]]></category>
            <category><![CDATA[jboss]]></category>
            <category><![CDATA[application-server]]></category>
            <dc:creator><![CDATA[Tatarao voleti]]></dc:creator>
            <pubDate>Thu, 26 Dec 2013 04:54:54 GMT</pubDate>
            <atom:updated>2018-12-01T11:26:24.892Z</atom:updated>
            <content:encoded><![CDATA[<h3>Install &amp; run (Wildfly) JBoss AS 7.1.1 on Windows</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8MQOOdKv0g7toW3xWKFrow.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/5uhag18P-Lc?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Armen Chlchatian</a> on <a href="https://unsplash.com/search/photos/fly?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p><strong>Introduction: </strong>From Wikipedia Source.</p><blockquote>The renaming to WildFly was done to reduce confusion. The renaming only affects the JBoss Application Server project. The JBoss Community or the Red Hat JBoss product line (with JBoss Enterprise Application Platform) all retain their names.</blockquote><h3><strong>Download and Installation</strong></h3><blockquote>You can download JBoss Application Server version 7.1.1 Final From JBoss Official Website.</blockquote><p><a href="http://www.jboss.org/jbossas/downloads/">http://www.jboss.org/jbossas/downloads/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*Ls3nEAanA84h4mEq" /></figure><blockquote>Download zip file of JBoss 7.1.1 Final. Extract the downloaded zip file to some where on your machine i.e, C:\ or D:\</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/233/0*SIg1Oka3pTzB_sh0" /></figure><p>Now installation got completed. Navigate to jboss-as-7.1.1.Final\bin directory and then double click on standalone.bat file. JBoss AS will be started automatically.</p><blockquote>The default port number of JBoss Application Server is <strong>8080</strong>, and admin console port number is <strong>9990</strong></blockquote><blockquote>Now we can see the welcome page of JBoss Application Server just by typing <a href="http://localhost:8080/">http://localhost:8080</a> at address bar of browser window.</blockquote><p>This is the welcome page of JBoss AS server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*Egdd7qK0L2aoeVmL" /></figure><h3><strong>How to change default port number of JBoss AS Server ?</strong></h3><blockquote>we can change the default port number of JBoss Server. All we have to do is,</blockquote><blockquote>Go to Jboss-as-7.1.1.Final\standalone\configuration directory and edit <strong>standalone.xml</strong> file</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*gLz072aZFYI_wGt4.png" /></figure><p>Find <em>&lt;socket-binding name=”http” port=”8080″/&gt; under &lt;socket-binding-group&gt;</em></p><blockquote>Replace ‘8080’ with desired port number i.e, 7070 or 9090 and then restart the server.</blockquote><p><a href="https://medium.com/enterprise-java/adding-user-in-jboss-app-server-7-final-41f2b0461b73">How to add user in JBoss Application Server</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc4e69b1e525" width="1" height="1" alt=""><hr><p><a href="https://medium.com/enterprise-java/jboss-as-7-1-1-final-tutorial-fc4e69b1e525">Install and run Wildfly application server</a> was originally published in <a href="https://medium.com/enterprise-java">Spring eco system</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>