<?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: Coding Saint</title>
    <description>The latest articles on DEV Community by Coding Saint (@codingsaint).</description>
    <link>https://dev.to/codingsaint</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%2F252532%2Fe5eaf5a5-e5c3-43a7-b6bd-e10768579b1f.png</url>
      <title>DEV Community: Coding Saint</title>
      <link>https://dev.to/codingsaint</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/codingsaint"/>
    <language>en</language>
    <item>
      <title>Spring Kafka Stream with Custom Objects</title>
      <dc:creator>Coding Saint</dc:creator>
      <pubDate>Tue, 10 Mar 2020 02:23:00 +0000</pubDate>
      <link>https://dev.to/codingsaint/spring-kafka-stream-with-custom-objects-3p</link>
      <guid>https://dev.to/codingsaint/spring-kafka-stream-with-custom-objects-3p</guid>
      <description>&lt;p&gt;Kafka is most sought after event system today. In this series we will look at Kafka event messaging and streaming.    &lt;/p&gt;

&lt;p&gt;Github Repository link : &lt;a href="https://github.com/CODINGSAINT/kafka-stream-spring"&gt;https://github.com/CODINGSAINT/kafka-stream-spring&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What will we be creating
&lt;/h2&gt;

&lt;p&gt;We will create a streaming application using Spring and kafka streams. &lt;br&gt;
 We will have a continuously coming stream of famous quotes which will be continously produced at &lt;code&gt;quote&lt;/code&gt; topic.  Every quote can be tagged with multiple categories i.e. &lt;code&gt;business,education,faith,famous-quotes,friendship,future,happiness,inspirational,life,love,nature,politics,proverb,religion,science,success,technology&lt;/code&gt; .&lt;br&gt;
 We will have topics related to each of the category. Once a quote comes we will be streaming them to respective category. To keep things simple for demo we have one listener listening to all of the topics&lt;br&gt;
 We have taken quotes from &lt;a href="https://github.com/lukePeavey/quotable/blob/master/data/sample/quotes.json"&gt;https://github.com/lukePeavey/quotable/blob/master/data/sample/quotes.json&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These quotes will be streamed and will be sent to respective topic based on their category.&lt;br&gt;
Listener will keep track of all the quotes which are streamed to these topics.&lt;/p&gt;

&lt;p&gt;.    &lt;/p&gt;

&lt;h2&gt;
  
  
  Installing kafka
&lt;/h2&gt;

&lt;p&gt;### Download &lt;br&gt;
 To start kafka we require zookeeper , on kafka website we have different versions you can get the latest stable vesion from &lt;a href="https://kafka.apache.org/downloads"&gt;Kafka download page&lt;/a&gt; Say you have downloaded  &lt;a href="http://mirrors.estointernet.in/apache/kafka/2.4.0/kafka_2.11-2.4.0.tgz"&gt;&lt;strong&gt;kafka_2.11-2.4.0.tgz&lt;/strong&gt;&lt;/a&gt;    &lt;/p&gt;

&lt;p&gt;&lt;code&gt;wget http://mirrors.estointernet.in/apache/kafka/2.4.0/kafka_2.11-2.4.0.tgz&lt;/code&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Unzip
&lt;/h3&gt;

&lt;p&gt;Use below command to unzip the downloaded file &lt;code&gt;tar xzf kafka_2.11-2.4.0.tgz&lt;/code&gt;&lt;br&gt;
 ### Move to user directory Move content to user directory&lt;br&gt;&lt;br&gt;
&lt;code&gt;mv kafka_2.11-2.4.0/* /usr/local/kafka&lt;/code&gt;&lt;br&gt;
 ### Run Zookeeper&lt;br&gt;
  Go to kafka directory and run&lt;br&gt;&lt;br&gt;
&lt;code&gt;cd /usr/local/kafka bin/zookeeper-server-start.sh config/zookeeper.properties&lt;/code&gt; ### Run Kafka Server Use below command to run kafka server&lt;br&gt;&lt;br&gt;
&lt;code&gt;bin/kafka-server-start.sh config/server.properties&lt;/code&gt; You will see logs confirming the kafka is up an running.    &lt;/p&gt;

&lt;h3&gt;
  
  
  Test kafka installation
&lt;/h3&gt;

&lt;p&gt;#### Create a topic&lt;br&gt;
  &lt;code&gt;&lt;br&gt;
 bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic kafka-test-topic    &lt;br&gt;
&lt;/code&gt;  &lt;/p&gt;

&lt;h4&gt;
  
  
  Verify if topic got created
&lt;/h4&gt;

&lt;p&gt;bin/kafka-topics.sh --list --zookeeper localhost:2181 kafka-test-topic&lt;br&gt;
 #### Send messages to topic&lt;br&gt;&lt;br&gt;
Use below command to activate message terminal to kafka-test-topic. Below command will activate message sending to a topic , key in some interesting messages. Lets call it producer window    &lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bin/kafka-console-producer.sh --broker-list localhost:9092 --topic kafka-test-topic &amp;gt;Welcome to Kafka 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4&gt;
  
  
  Consume the topic Open another terminal to consume messages
&lt;/h4&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt; bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic kafka-test-topic --from-beginning    
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now whatever you key in to producer window will be consumed to consumer window    &lt;/p&gt;

&lt;h3&gt;
  
  
  Other ways to install kafka
&lt;/h3&gt;

&lt;p&gt;There could be many other ways to install and run like using apt installer on Ubuntu , using a docker image etc. The above one is a generic setup .    &lt;/p&gt;

&lt;h3&gt;
  
  
  Create Topics for for app
&lt;/h3&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic quotes  
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic business  
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic education  
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic faith  
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic famous-quotes  
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic famous-quotes  
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic friendship  
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic future  
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic happiness  
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic inspirational  
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic life  
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic love  
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic nature  
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic politics  
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic proverb  
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic religion  
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic science  
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic success  
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic technology  
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  Creating Spring Boot Kafka Stream project
&lt;/h2&gt;

&lt;p&gt;We will create project using &lt;a href="https://start.spring.io"&gt;https://start.spring.io&lt;/a&gt; . &lt;br&gt;
Go to website and dependencies&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---4q3Frar--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lh3.googleusercontent.com/_X8RJU5IQE1LUUONCukFpCfnANN6HmH3gsVnzirWd74nmWCNluCtMx66uekRE9I1cdYU28jgDjXdbtBNLCOfUMHdxjlZLoIa6gHn5d2pMDjqRJPN9ep4TK9bHdoFaO53M-X5VffpbYz6u1GXh2sLiAmkzAvXvIfs7-to1buqdwascl3WNQzkZ023ygtUVM6avXqr_hXJM9REiOteI-RYIFN-e4XVT9ghfqJBfrEGv7KtARU7NH_EVt2-Lrb8JzeLRGn_2wyaySSC-Anbv11PhW34obCiUE_ws90pCq48v9N6N0upNnYU_PEtW193dXJX3cZLVjmfMrpr9yc8YT_0x6HqNK6qJfoylhoc91hwgJqeecoDCHNRLI2C2mAVOZpunkAJQO_JcibsCLkUlMoahWF41TrJE3j6DPsd-yOHesel-dK_Ngc2Xt5IZu8coWWdZM_BGfWTxMm5e8MIZrDq74AJOEvzFhDeByFH4cOOdqkSooi1-Jqgh_fIumaags3NMNYjtTKAEeRjFVr_Gaa6l37qr8Iaepm8rIRfVlBz3A-HXqOa5KCJ5JAtf8cqc8yOgQlkYC6arT4GsmUsSjOjlxp5e86k65B1z1kDK79Ct4jQBj5DdPNiuL5HnxLZ0EIkGSwqK5EEPEob8ObLeH0noyiBd_5reWwqFMqCPdTX_MVu2DJLXsoha8bpkLqTOxoYsWLmTA3gy80kFV6CcB-9S-uWuabrvL1HK-wIJSUDzipkrgTh%3Dw1190-h669-no" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---4q3Frar--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lh3.googleusercontent.com/_X8RJU5IQE1LUUONCukFpCfnANN6HmH3gsVnzirWd74nmWCNluCtMx66uekRE9I1cdYU28jgDjXdbtBNLCOfUMHdxjlZLoIa6gHn5d2pMDjqRJPN9ep4TK9bHdoFaO53M-X5VffpbYz6u1GXh2sLiAmkzAvXvIfs7-to1buqdwascl3WNQzkZ023ygtUVM6avXqr_hXJM9REiOteI-RYIFN-e4XVT9ghfqJBfrEGv7KtARU7NH_EVt2-Lrb8JzeLRGn_2wyaySSC-Anbv11PhW34obCiUE_ws90pCq48v9N6N0upNnYU_PEtW193dXJX3cZLVjmfMrpr9yc8YT_0x6HqNK6qJfoylhoc91hwgJqeecoDCHNRLI2C2mAVOZpunkAJQO_JcibsCLkUlMoahWF41TrJE3j6DPsd-yOHesel-dK_Ngc2Xt5IZu8coWWdZM_BGfWTxMm5e8MIZrDq74AJOEvzFhDeByFH4cOOdqkSooi1-Jqgh_fIumaags3NMNYjtTKAEeRjFVr_Gaa6l37qr8Iaepm8rIRfVlBz3A-HXqOa5KCJ5JAtf8cqc8yOgQlkYC6arT4GsmUsSjOjlxp5e86k65B1z1kDK79Ct4jQBj5DdPNiuL5HnxLZ0EIkGSwqK5EEPEob8ObLeH0noyiBd_5reWwqFMqCPdTX_MVu2DJLXsoha8bpkLqTOxoYsWLmTA3gy80kFV6CcB-9S-uWuabrvL1HK-wIJSUDzipkrgTh%3Dw1190-h669-no" alt="Spring Boot Kafka Stream dependencies"&gt;&lt;/a&gt;    &lt;/p&gt;

&lt;p&gt;Download the project and open in your favourite IDE and open it.&lt;br&gt;
Now we have Kafka installed up and running , as a First step we should be creating Quote bean which will flow the quotes from producer to consumer.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Getter
@Setter
@ToString
public class Quote {
private String content;
private Set&amp;lt;String&amp;gt; tags;
private String author;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Let's add required configurations for  Kafka. This includes Serializer and Deserializer&lt;br&gt;
for Quotes.We have configurations for Spring Kafka template , producer and consumer.&lt;br&gt;
Serialization and Deserialiation for key and value objects(POJO) have been mentioned seperately.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spring:
  kafka:
    listener:
      missing-topics-fatal: false
    client-id : quotes-app
    bootstrap-server:
      - localhost:9091
      - localhost:9001
      - localhost:9092
    template:
      default-topic: quotes
    producer:
      key-serializer: org.apache.kafka.common.serialization.StringSerializer
      value-serializer: com.codingsaint.learning.kafkastreamspring.QuoteSerializer
    consumer:
      properties:
        partition:
          assignment:
            strategy: org.apache.kafka.clients.consumer.RoundRobinAssignor
      group-id: random-consumer
      auto-offset-reset: earliest
      key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
      value-deserializer: com.codingsaint.learning.kafkastreamspring.QuoteDeserializer
---
kafka:
  topic:
    input: quotes
    output: business,education,faith,famous-quotes,friendship,future,happiness,inspirational,life,love,nature,politics,proverb,religion,science,success,technology
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;We will create  QuoteSerializer , QuoteDeserializer and QuoteSerde which will have both serializer and deserializer &lt;br&gt;
.We are using simple ObjectMapper to serialize and deserialize&lt;/p&gt;

&lt;h5&gt;
  
  
  QuoteSerializer
&lt;/h5&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class QuoteSerializer implements Serializer&amp;lt;Quote&amp;gt; {

    @Override
    public byte[] serialize(String s, Quote quote) {
        byte[] retVal = null;
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            retVal = objectMapper.writeValueAsString(quote).getBytes();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return retVal;
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4&gt;
  
  
  QuoteDeserializer
&lt;/h4&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class QuoteDeserializer implements Deserializer&amp;lt;Quote&amp;gt; {

    @Override
    public Quote deserialize(String s, byte[] bytes) {
        ObjectMapper mapper = new ObjectMapper();
        Quote quote = null;
        try {
            quote = mapper.readValue(bytes, Quote.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return quote;
    }

}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4&gt;
  
  
  QuoteSerde
&lt;/h4&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class QuoteSerde implements Serde&amp;lt;Quote&amp;gt; {
    public QuoteSerde() {
    }

    @Override
    public Serializer&amp;lt;Quote&amp;gt; serializer() {
        return new QuoteSerializer();
    }

    @Override
    public Deserializer&amp;lt;Quote&amp;gt; deserializer() {
        return new QuoteDeserializer();
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now Let us see the AppConfig class for configuring Producer and Consumer configurations.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Configuration
@EnableKafka
@EnableKafkaStreams
public class AppConfig {
    private static final Logger LOGGER= LoggerFactory.getLogger(AppConfig.class);

    @Value("${kafka.topic.input}")
    private String inputTopic;

    @Value("#{'${kafka.topic.output}'.split(',')}")
    private List&amp;lt;String&amp;gt; allTopics;


    @Autowired
    private KafkaProperties kafkaProperties;

    /**
     * Configurations for KafkaStreams
     * @param kafkaProperties Will take defaults from application YAML or Properties file with spring.kafka
     * @return kafkaConfiguration
     */
    @Bean(name= KafkaStreamsDefaultConfiguration.DEFAULT_STREAMS_CONFIG_BEAN_NAME)
    public KafkaStreamsConfiguration kafkaConfiguration(final KafkaProperties kafkaProperties){
        Map&amp;lt;String, Object&amp;gt; config = new HashMap&amp;lt;&amp;gt;();
        config.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaProperties.getBootstrapServers());
        config.put(StreamsConfig.APPLICATION_ID_CONFIG, kafkaProperties.getClientId());
        config.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.String().getClass());
        config.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, QuoteSerde.class.getName() );
        config.put(StreamsConfig.DEFAULT_DESERIALIZATION_EXCEPTION_HANDLER_CLASS_CONFIG, LogAndContinueExceptionHandler.class);
        return new KafkaStreamsConfiguration(config);
    }

    /**
     * The Stream which delegates each incoming topic to respective destination topic
     * @param kStreamsBuilder
     * @return
     */
    @Bean
    public KStream&amp;lt;String,Quote&amp;gt; kStream(StreamsBuilder kStreamsBuilder){
        KStream&amp;lt;String,Quote&amp;gt; stream=kStreamsBuilder.stream(inputTopic);
        for(String topic:allTopics){
            stream.filter((s, quote) -&amp;gt; quote.getTags().contains(topic)).to(topic);
        }
        return stream;

    }

    /**
     * Kafka ConsumerFactory configurations
     * @return
     */
    @Bean
    public ConsumerFactory&amp;lt;String, Quote&amp;gt; consumerFactory() {
        Map&amp;lt;String, Object&amp;gt; props = new HashMap&amp;lt;&amp;gt;();
        props.put(
                ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,
                kafkaProperties.getBootstrapServers());
        props.put(
                ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,
                StringDeserializer.class);
        props.put(
                ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,
                BytesDeserializer.class);
        return new DefaultKafkaConsumerFactory&amp;lt;&amp;gt;(props);
    }

    /**
     * Required Configuration for POJO to JSON
     * @return ConcurrentKafkaListenerContainerFactory
     */
    @Bean
    public ConcurrentKafkaListenerContainerFactory&amp;lt;String, Quote&amp;gt;
    kafkaListenerContainerFactory() {

        ConcurrentKafkaListenerContainerFactory&amp;lt;String, Quote&amp;gt; factory =
                new ConcurrentKafkaListenerContainerFactory&amp;lt;&amp;gt;();
        factory.setConsumerFactory(consumerFactory());
        factory.setMessageConverter(new StringJsonMessageConverter());
        return factory;
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;  Since we have injected default KafkaProperties will have required bindings from application.yml .&lt;/li&gt;
&lt;li&gt;  Beans for default Kafka Stream ,consumer factory and &lt;code&gt;ConcurrentKafkaListenerContainerFactory&lt;/code&gt; is created where &lt;code&gt;ConcurrentKafkaListenerContainerFactory&lt;/code&gt; bean help us to convert incoming message from String to Json using &lt;code&gt;StringJsonMessageConverter&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;  KStream bean helps to create a stream on input topic (quotes) and filter based on tags. For each tag we already have created topics.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now Let us look at Listener configuration which will listen all the topics&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Component
public class TopicConsumers {
    private static final Logger LOGGER = LoggerFactory.getLogger(TopicConsumers.class);

    @Value("#{'${kafka.topic.output}'.split(',')}")
    private List&amp;lt;String&amp;gt; allTopics;

    /**
     * For simplicity we are listening all topics at one listener
     */

    @KafkaListener(id = "allTopics", topics = "#{'${kafka.topic.output}'.split(',')}",
            containerFactory = "kafkaListenerContainerFactory")
    public void consume(@Payload Quote quote,
                        @Header(KafkaHeaders.RECEIVED_PARTITION_ID) int partition,
                        @Header(KafkaHeaders.RECEIVED_TOPIC) String incomingTopic,
                        @Header(KafkaHeaders.RECEIVED_TIMESTAMP) long ts
    ) {
        LOGGER.info("Incoming quote {}-&amp;gt; {}", incomingTopic, quote);
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;  For simplicity we are listening all of these topics at one Listener&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once we run the application we will see logs confirming publishing of quotes with different tags and streams sending them to their respective category. Listener will listen incoming quotes.&lt;/p&gt;

</description>
      <category>spring</category>
      <category>kafka</category>
      <category>springboot</category>
      <category>kafkastreams</category>
    </item>
    <item>
      <title>Spring Microservices </title>
      <dc:creator>Coding Saint</dc:creator>
      <pubDate>Thu, 27 Feb 2020 13:10:20 +0000</pubDate>
      <link>https://dev.to/codingsaint/spring-microservices-3o1a</link>
      <guid>https://dev.to/codingsaint/spring-microservices-3o1a</guid>
      <description>&lt;h1&gt;
  
  
  Welcome to Micoservices by Coding Saint!
&lt;/h1&gt;

&lt;p&gt;The new buzzword in industry is  &lt;strong&gt;microservices&lt;/strong&gt;. This repository is the source code for the step by step tutorial at online course &lt;a href="https://www.udemy.com/course/spring-boot-and-rest-api/?couponCode=SPRING50"&gt;Spring REST API and Microserivces&lt;/a&gt; . You can follow above link and can get the step by step video reference at 90% discount. &lt;br&gt;
&lt;a href="https://www.udemy.com/course/spring-boot-and-rest-api/"&gt;https://www.udemy.com/course/spring-boot-and-rest-api/?referralCode=61F8139662DFDFE6DB67&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Table of Content
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;  Introduction&lt;/li&gt;
&lt;li&gt;Advantages and Drawbacks of Microservices&lt;/li&gt;
&lt;li&gt;User Service&lt;/li&gt;
&lt;li&gt;ToDo Service&lt;/li&gt;
&lt;li&gt;Feign Declarative REST Client&lt;/li&gt;
&lt;li&gt;Ribbon Load Balancer&lt;/li&gt;
&lt;li&gt; Service Discovery in Microservices using Eureka&lt;/li&gt;
&lt;li&gt; Use of Config Server&lt;/li&gt;
&lt;li&gt; Zuul API gateway&lt;/li&gt;
&lt;li&gt; Distributed Tracing&lt;/li&gt;
&lt;li&gt; Zipkins UI to view traces&lt;/li&gt;
&lt;li&gt;Hystrix Fault tolerance&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;From inception of software design what needed to be improved which brought this new concept . We need to understand a work “&lt;strong&gt;Monolith&lt;/strong&gt;”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VfKN6evs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.github.com/CODINGSAINT/microservices/master/images/monolith.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VfKN6evs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.github.com/CODINGSAINT/microservices/master/images/monolith.png" alt=" Monolith "&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Monolith&lt;/strong&gt; refers a kind of software which keeps all the component required by it within itself. Say we have to create a E Commerce we need to have User authentication, product services, cart management, payment integration ,recommendation service etc. A monolith is one application which has all of them embedded to it.&lt;/p&gt;
&lt;h3&gt;
  
  
  Microservices
&lt;/h3&gt;

&lt;p&gt;Microservices as certainly a buzz word all around. We have been in an era where distributed and scaleable systems have need of the hour. As the business grows the number the pressure on systems also increases. In order to keep up with increased load we scale our application. In this process we end up scaling entire monolith. In monolith we have all modules added to single application. While our load will be for certain modules ,we still end up scaling entire application.&lt;/p&gt;
&lt;h4&gt;
  
  
  Scaling Monolith
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lDVJ7XCT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.github.com/CODINGSAINT/microservices/master/images/scalingMonolith.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lDVJ7XCT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.github.com/CODINGSAINT/microservices/master/images/scalingMonolith.png" alt="enter image description here"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In above example , if we have a E commerce service as monolith, it is expected to have more hits at product and search modules rather cart and delivery tracking modules but when we scale up we will end up scaling all of the modules. This will increase memory and heap size and will require unnecessary resources.&lt;br&gt;&lt;br&gt;
Microservices solves exact same problem. In microservices we have well defined modules as a separate service all of them talking independently via HTTP/MQ or any protocol. Now once we notice increase in product services and search module, we will scale only that component.&lt;/p&gt;
&lt;h4&gt;
  
  
  Microservices scaling
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZHJPNbZc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.github.com/CODINGSAINT/microservices/master/images/Microservice_benefits.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZHJPNbZc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.github.com/CODINGSAINT/microservices/master/images/Microservice_benefits.png" alt="enter image description here"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Advantages and Drawbacks of Microservice
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Advantages of Microservices
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt; Improved fault tolerance&lt;/li&gt;
&lt;li&gt; Easy to understand&lt;/li&gt;
&lt;li&gt; No vendor or technology lock in&lt;/li&gt;
&lt;li&gt; Easy to add new modules
##### Improved fault tolerance&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Microservices helps you to be highly available. Since once we adopt microservices , we move towards distributed systems , In case of a monolith if a the system or network is down typically entire system is down. In Monolith as we know services are tightly coupled , error at one service will impact other one too. In Microservices , we design in a way that even if one component is down , entire service will not be impacted. We can use fault tolerance and write code for fallbacks. For example if we have fallback for some critical modules , in case of the service being down fallbacks will be invoked , say in a e-commerce microservice recommendation-service is down, we can have fallbacks with static recommendations. It improves our fault tolerance.&lt;/p&gt;
&lt;h5&gt;
  
  
  Easy to understand
&lt;/h5&gt;

&lt;p&gt;Each module is granular. It has it’s own domain, All it has to do is to take care of itself. Obviously it is easy to understand a smaller piece than entire monolith system4&lt;/p&gt;
&lt;h5&gt;
  
  
  No vendor or technology lock in
&lt;/h5&gt;

&lt;p&gt;The is no vendor lock in , Each module can have it’s own database, a different programming language and still communicate via HTTP REST protocol , or messaging queues etc.&lt;/p&gt;
&lt;h5&gt;
  
  
  Easy to add new modules
&lt;/h5&gt;

&lt;p&gt;Once a new feature is required we don’t have to write in same monolith with a fear of breaking changes. We can easily spin up a new microservices and it doesn’t have to break existing system.&lt;/p&gt;

&lt;p&gt;All your files and folders are presented as a tree in the file explorer. You can switch from one to another by clicking a file in the tree.&lt;/p&gt;
&lt;h3&gt;
  
  
  Drawbacks of Microservices
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt; Distributed systems are complex to understand&lt;/li&gt;
&lt;li&gt; Multiple database make it complex to maintain transactional consistency.&lt;/li&gt;
&lt;li&gt; Tough to test&lt;/li&gt;
&lt;li&gt; Could be tough to deploy&lt;/li&gt;
&lt;/ol&gt;
&lt;h5&gt;
  
  
  Distributed systems are complex to understand
&lt;/h5&gt;

&lt;p&gt;Distributed system are complex. Tough a individual module could be very easy to understand but how it fit in entire big microservice landscape ,interacting with each other could be tough to understand.&lt;/p&gt;
&lt;h5&gt;
  
  
  Multiple database make it complex to maintain transactional consistency.
&lt;/h5&gt;

&lt;p&gt;This is one of the most talked about problem of a microservice architecture . In a monolith , it is one database where all modules related tables are there . It is easy to maintain transactional consistency . For example , if one the operation fails we can easily rollback entire transaction. In microservices , all services have different databases. Many a times one operation requires interaction with multiple services. To guarantee a transaction in all databases over different servers it not possible. To avoid it we use eventual consistency but still transaction consistency is complex.We need to design fail over scenarios well in advance.&lt;/p&gt;
&lt;h5&gt;
  
  
  Tough to test
&lt;/h5&gt;

&lt;p&gt;One single database , one application , single source to to test is obviously easy than to test one operation where multiple miroservices with multiple database are interacting.&lt;/p&gt;
&lt;h5&gt;
  
  
  Could be tough to deploy
&lt;/h5&gt;

&lt;p&gt;So many microservices , and over that one depending on another , with so many different technology stack is challenging for sure.&lt;/p&gt;

&lt;p&gt;Now after reading above , if you are designing microservices you must ask is it required. Do I have to deal with so many transaction and incming requests that we need to decompose monolith. Will I have infrastructure ready at will to scale microservices or new one. If your answer is yes, please go ahead but always remember &lt;strong&gt;&lt;em&gt;MICROSERVICES are not silver bullet.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  User Service
&lt;/h2&gt;

&lt;p&gt;This microservice will help us to create user and call another microservice i.e. TODO microservice to get all the todos assigned to user and return user along with its todos.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A simple microservice . &lt;/li&gt;
&lt;li&gt;Manages users

&lt;ul&gt;
&lt;li&gt;Create /Update/Delete User &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;User service in this tutorial runs on port &lt;strong&gt;8082&lt;/strong&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Important APIs of User Service
&lt;/h3&gt;
&lt;h4&gt;
  
  
  Create User
&lt;/h4&gt;

&lt;p&gt;URL :  &lt;a href="http://localhost:8082/v1/user"&gt;http://localhost:8082/v1/user&lt;/a&gt; &lt;br&gt;
METHOD TYPE: POST&lt;br&gt;
Request Body :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "firstName":"Ray",
  "lastName":"mcfallen",    
   "userName":"ray",
  "email":"ray@codingsaint.com"
} 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Response Body:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
'id':2,
"firstName":"Ray",
"lastName":"mcfallen",  
"userName":"ray",
"email":"ray@codingsaint.com"
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Get User With tasks
&lt;/h4&gt;

&lt;p&gt;URL :  &lt;a href="http://localhost:8082/v1/user/2/tasks"&gt;http://localhost:8082/v1/user/2/tasks&lt;/a&gt;&lt;br&gt;
METHOD TYPE: GET&lt;br&gt;
Response Body&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  TODO Service
&lt;/h2&gt;

&lt;p&gt;ToDo Service will be used to create task for users, It create task and assign it to particular user based on user id.&lt;/p&gt;

&lt;h3&gt;
  
  
  Important APIs of User Service
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Create Task
&lt;/h4&gt;

&lt;p&gt;URL :  &lt;a href="http://localhost:8083/task"&gt;http://localhost:8083/task&lt;/a&gt;&lt;br&gt;
METHOD TYPE: POST&lt;br&gt;
Request Body :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{ 
"name":"Create Micoservice Couse : Config Server", 
"description":"Create Video tutorial task service",   
"isDone":false, 
  "targetDate":"2019-08-05", 
    "userId":2, 
      "categories":[   
         {"name":"Microservice Tutorial"
         }
         ]
}  
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Response Body:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{ 
"id":2,
"name":"Create Micoservice Couse : Config Server", 
"description":"Create Video tutorial task service",   
"isDone":false, 
  "targetDate":"2019-08-05", 
    "userId":2, 
      "categories":[   
         {"name":"Microservice Tutorial"
         }
         ]
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Get  tasks of a User
&lt;/h4&gt;

&lt;p&gt;URL :  &lt;a href="http://localhost:8083/user/2/tasks"&gt;http://localhost:8083/user/2/tasks&lt;/a&gt;&lt;br&gt;
METHOD TYPE: GET&lt;/p&gt;

&lt;h2&gt;
  
  
  Feign Declarative REST Client
&lt;/h2&gt;

&lt;p&gt;Feign Declarative REST client helps us to remove boilerplate code of REST API.&lt;br&gt;
We will use it in &lt;strong&gt;User Service&lt;/strong&gt;  to remove rest call to task service where we had been using rest template.&lt;br&gt;
In order to do that &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;add openfeign at pom.xml
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;dependency&amp;gt;
  &amp;lt;groupId&amp;gt;org.springframework.cloud&amp;lt;/groupId&amp;gt;
  &amp;lt;artifactId&amp;gt;spring-cloud-starter-openfeign&amp;lt;/artifactId&amp;gt;
&amp;lt;/dependency&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Add annotation at User application main class
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt; @EnableFeignClients
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create a Service class with annotation @FeignClient and method for Feign as below
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Service
@FeignClient(name="task-service" ,url="http://localhost:8083/")
public interface TaskService {
@RequestMapping("user/{id}/tasks")
ResponseEntity&amp;lt;List&amp;lt;Task&amp;gt; &amp;gt; userTasks(@PathVariable ("id") Long userId);
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Remove Rest call at Controller and user TaskService method
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ResponseEntity&amp;lt;List&amp;lt;Task&amp;gt;&amp;gt; tasks =taskService.userTasks(id);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Ribbon Load Balancer
&lt;/h2&gt;

&lt;p&gt;Load balancing is important factor when communicating between multiple microservices. &lt;br&gt;
 In our example We will be running 2 instances of Todo Service and 1 User Service , We will add &lt;strong&gt;ribbon&lt;/strong&gt; at user service toload balance Todo service calls.&lt;br&gt;
 Steps to add Ribbon load balancer.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add Ribbon dependency
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt; &amp;lt;dependency&amp;gt;
            &amp;lt;groupId&amp;gt;org.springframework.cloud&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;spring-cloud-starter-netflix-ribbon&amp;lt;/artifactId&amp;gt;
&amp;lt;/dependency&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Modify TaskService as below. Notice that FeignClient with URL is commented , its just for your reference ,it can be removed
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Service
//@FeignClient(name="task-service" ,url="http://localhost:8083/")
@FeignClient(name="task-service" )
@RibbonClient(name="task-service")
public interface TaskService {
    @RequestMapping("user/{id}/tasks")
    ResponseEntity&amp;lt;List&amp;lt;Task&amp;gt; &amp;gt; userTasks(@PathVariable ("id") Long userId);
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now add List of servers for Task Service at application.yml
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;task-service:
  ribbon:
    listOfServers: http://localhost:8083/,http://localhost:8085/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This will enable the task service instances to be picked from yaml file.&lt;/p&gt;

&lt;h3&gt;
  
  
  Service Discovery in Microservices using Eureka
&lt;/h3&gt;

&lt;p&gt;The problem with above approach is to define list of servers with every new instances coming up and down. We would certainly not want to do it as it will require to restart services after change in application.yml&lt;br&gt;
We can use Eureka Service discovery to avoid it. &lt;/p&gt;

&lt;h4&gt;
  
  
  Steps to create Eureka Service Discovery Server
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;a href="https://start.spring.io"&gt;https://start.spring.io&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Select Eureka as dependency and download the project&lt;/li&gt;
&lt;li&gt;Import project to IDE&lt;/li&gt;
&lt;li&gt;At Main class add &lt;code&gt;@EnableEurekaServer&lt;/code&gt; annotation.&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;server.port =8761&lt;/code&gt; to start at different port.
#### Connecting clients to Eureka for discovery
At User service and Task service pom&lt;/li&gt;
&lt;li&gt;Add dependency for Eureka client
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt; &amp;lt;dependency&amp;gt;
            &amp;lt;groupId&amp;gt;org.springframework.cloud&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;
                spring-cloud-starter-netflix-eureka-client
            &amp;lt;/artifactId&amp;gt;
&amp;lt;/dependency&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Add Eureka server location to connect at application.yml
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;eureka:
  client:
    service-url:
      defaultZone: http://localhost:8761/eureka/  
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Use of Config Server
&lt;/h3&gt;

&lt;p&gt;To manage configuration of different services effectively we use config server. Config server is a separate microservice which keeps track of configurations.&lt;/p&gt;

&lt;h4&gt;
  
  
  Steps to create config server
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;a href="https://start.spring.io"&gt;https://start.spring.io&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Select config server as dependency and download the project&lt;/li&gt;
&lt;li&gt;Import project to IDE&lt;/li&gt;
&lt;li&gt;At Main class add &lt;code&gt;@EnableConfigServer&lt;/code&gt; annotation.&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;server.port =9000&lt;/code&gt; to start at different port.&lt;/li&gt;
&lt;li&gt;Create another git project and add configuration files to it. For example user service should have a file names user-service.yml and task-service should have a file named task-service.yml&lt;/li&gt;
&lt;li&gt;Add location of git in application.yml of config-server
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spring:
  cloud:
    config:
      server:
        git:
          uri: https://github.com/CODINGSAINT/config.git
  application:
    name: config-server
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Connecting clients to Config server
&lt;/h4&gt;

&lt;p&gt;At User service and Task service pom&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add dependency for config client
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt; &amp;lt;dependency&amp;gt;
            &amp;lt;groupId&amp;gt;org.springframework.cloud&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;spring-cloud-starter-config&amp;lt;/artifactId&amp;gt;
&amp;lt;/dependency&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create a file bootstrap.yml and add config server location to connect at bootstrap.yml
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spring:
  application:
    name: user-service
  cloud:
    config:
      uri: 
        - http://localhost:9000 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now at start up services will connect to config server to get there configurations.* &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Zuul API gateway
&lt;/h3&gt;

&lt;p&gt;Different microservices will have different ports and many times we require to perform operations (filters) before these incoming requests even hit our services. &lt;br&gt;
 To perform better operations for incoming request we will add a gateway . We call it Zuul API gateway in our case.&lt;br&gt;
 #### Create API gateway &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;a href="https://start.spring.io"&gt;https://start.spring.io&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;Select Zuul API gateway as dependency and download the project&lt;/li&gt;
&lt;li&gt;Import project to IDE&lt;/li&gt;
&lt;li&gt;At Main class add &lt;code&gt;@@EnableZuulProxy&lt;/code&gt; annotation.&lt;/li&gt;
&lt;li&gt;create file bootstrap.yml and delete application.yml&lt;/li&gt;
&lt;li&gt;Add below configuration for it
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt; spring:
  application:
    name: api-gateway
  cloud:
    config:
      uri: 
        - http://localhost:9000
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create file named api-gateway.yml and commit at config git project created above&lt;/li&gt;
&lt;li&gt;Below are content for api-gateway.yml
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  spring:
  application:
    name: api-gateway
  cloud:
    config:
      uri: 
        - http://localhost:9000

zuul:
  prefix: /api
  routes:
    user-service:
      path: /user-service/**
      service-id: user-service
    task-service:
      path: /task-service/**
      service-id: task-service

#Eureka
eureka:
  client:
    service-url:
      defaultZone: http://localhost:8761/eureka 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;In above configuration &lt;strong&gt;routes&lt;/strong&gt; configurations will help us to add routes for different services.&lt;br&gt;
  To access URL of any service we can add service-name and hit postman for example to access user-service url for getting user-service and its respective task we can use&lt;br&gt;
  &lt;a href="http://localhost:8080/user-service/v1/user/2/tasks"&gt;http://localhost:8080/user-service/v1/user/2/tasks&lt;/a&gt;&lt;br&gt;
  Where user service URL was&lt;br&gt;
  &lt;a href="http://localhost:8082/v1/user/2/tasks"&gt;http://localhost:8082/v1/user/2/tasks&lt;/a&gt;&lt;/p&gt;

</description>
      <category>spring</category>
      <category>microservices</category>
    </item>
    <item>
      <title>Developing First Spring Boot Application</title>
      <dc:creator>Coding Saint</dc:creator>
      <pubDate>Wed, 19 Feb 2020 09:35:50 +0000</pubDate>
      <link>https://dev.to/codingsaint/developing-first-spring-boot-application-3e49</link>
      <guid>https://dev.to/codingsaint/developing-first-spring-boot-application-3e49</guid>
      <description>&lt;p&gt;Spring Boot currently support Java, Kotlin and Groovy as language preference to create an application. You can also choose Maven or Gradle as a build automation tool. You can choose your favourite IDE ranging from Netbeans, IntelliJ ,Eclipse or Spring Tool Suite.&lt;/p&gt;

&lt;p&gt;We will be using Java and Maven with Spring Tool Suite.&lt;/p&gt;

&lt;p&gt;We can create a Spring Boot application in different ways.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creating a maven project and adding dependencies&lt;/li&gt;
&lt;li&gt;Using Spring Tool Suite (STS )/IntelliJ built in feature&lt;/li&gt;
&lt;li&gt;Using Spring Initializr : &lt;a href="https://start.spring.io"&gt;https://start.spring.io&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We will be using STS built in feature and will also look at Spring Initializr. In order to create first spring boot application using STS , click on File → New → Spring Starter Project.&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lK9otXnd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/codingsaint.com/wp-content/uploads/2018/10/null.png%3Fresize%3D624%252C84%26ssl%3D1" class="article-body-image-wrapper"&gt;&lt;img title="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--lK9otXnd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/codingsaint.com/wp-content/uploads/2018/10/null.png%3Fresize%3D624%252C84%26ssl%3D1" alt="" width="624" height="84"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--S6wHlNsN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/codingsaint.com/wp-content/uploads/2018/10/image.png%3Fresize%3D329%252C428%26ssl%3D1" class="article-body-image-wrapper"&gt;&lt;img title="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--S6wHlNsN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/codingsaint.com/wp-content/uploads/2018/10/image.png%3Fresize%3D329%252C428%26ssl%3D1" alt="" width="329" height="428"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;It will open a popup , where default values can be modified.&lt;/p&gt;

&lt;p&gt;We have modified name, group ,artifact and package default values.&lt;/p&gt;

&lt;p&gt;Once modified as per your requirement ,click “Next”.&lt;/p&gt;

&lt;p&gt;Now select Web from web stack and Devtools from Core stack.&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rpxRmfgc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/codingsaint.com/wp-content/uploads/2018/10/image1.png%3Fresize%3D286%252C369%26ssl%3D1" class="article-body-image-wrapper"&gt;&lt;img title="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--rpxRmfgc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/codingsaint.com/wp-content/uploads/2018/10/image1.png%3Fresize%3D286%252C369%26ssl%3D1" alt="" width="286" height="369"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Selecting Dev Tool is optional. It is just because of personal choice of not starting application again and again on saving the files. We will learn about DevTool later.&lt;/p&gt;

&lt;p&gt;Web is an obvious choice as we are going to learn a web based Spring Boot application.&lt;/p&gt;

&lt;p&gt;Click Finish. Now we have a sample Spring boot application ready to go.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Sn3UKj-Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/codingsaint.com/wp-content/uploads/2018/10/image2.png%3Fresize%3D324%252C342%26ssl%3D1" class="article-body-image-wrapper"&gt;&lt;img title="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--Sn3UKj-Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/codingsaint.com/wp-content/uploads/2018/10/image2.png%3Fresize%3D324%252C342%26ssl%3D1" alt="" width="324" height="342"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;After clicking on finish , we will have project structure as shown in figure below.&lt;/p&gt;

&lt;p&gt;Here UserServiceApplication.java inside com.codingsaint.userservice is the main class and entry point to our application.&lt;/p&gt;

&lt;p&gt;Every Spring Boot Application has a main class, which acts as the entry point to application.&lt;/p&gt;

&lt;p&gt;Let’s run it and see if Spring Boot application is really this easy to start and run. You can run it as a Java Application by right clicking on file and selecting Run as from menu and selecting “ Java Application” or “Spring Boot App” as an option.&lt;/p&gt;

&lt;p&gt;Once you run it , you can see output as below on console ,where it does tell that application is running on port 8080.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eR5-R7jj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/codingsaint.com/wp-content/uploads/2018/10/null1.png%3Fresize%3D624%252C104%26ssl%3D1" class="article-body-image-wrapper"&gt;&lt;img title="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--eR5-R7jj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/codingsaint.com/wp-content/uploads/2018/10/null1.png%3Fresize%3D624%252C104%26ssl%3D1" alt="" width="624" height="104"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;In browser open &lt;a href="http://localhost:8080/" rel="nofollow"&gt;&lt;/a&gt;&lt;a href="http://localhost:8080/"&gt;http://localhost:8080/&lt;/a&gt; and verify if server is up. Following output with 404 (default 404 of Spring Boot application) tells that server is up and running and obviously we have nothing mapped to be displayed for base URL so we are seeing this 404 error page.&lt;/p&gt;

&lt;p&gt;In Next section , we will see how to handle incoming requests properly. We will also dive in Spring Boot Basics&lt;/p&gt;

</description>
      <category>springboot</category>
      <category>java</category>
      <category>spring</category>
    </item>
    <item>
      <title>Quarkus IO : Supersonic Subatomic Mircoservices Introduction</title>
      <dc:creator>Coding Saint</dc:creator>
      <pubDate>Tue, 18 Feb 2020 09:32:03 +0000</pubDate>
      <link>https://dev.to/codingsaint/quarkus-io-supersonic-subatomic-mircoservices-introduction-1fp2</link>
      <guid>https://dev.to/codingsaint/quarkus-io-supersonic-subatomic-mircoservices-introduction-1fp2</guid>
      <description>&lt;h1&gt;
  
  
  Quarkus IO : Supersonic Subatomic Mircoservices ready framework course
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Quarkus IO is a microservices based java framework. According to QuarkusIO website , Quarkus is "&lt;em&gt;A Kubernetes Native Java stack tailored for OpenJDK HotSpot &amp;amp; GraalVM, crafted from the best of breed Java libraries and standards&lt;/em&gt;". This course will talks about creating microservices based on Quarkus. We will be going through&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Installing required software for understanding full features of Quarkus&lt;/li&gt;
&lt;li&gt; Building Todo and User Microservices using Quarkus&lt;/li&gt;
&lt;li&gt; Building superfast native images&lt;/li&gt;
&lt;li&gt; Writing test cases&lt;/li&gt;
&lt;li&gt; Using Hibernate and Mongodb database as backend&lt;/li&gt;
&lt;li&gt; Creating microservices architecture using Fallbacks and distributed logginh&lt;/li&gt;
&lt;li&gt; deploying them in cloud&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Installing Software
&lt;/h1&gt;

&lt;p&gt;In this section we will look at installing software required for this course. This is a prerequisite if you want to follow along this course. We will be installing . We will be installing on Linux based system but you can install on your desired operation system&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; JDK 1.8+&lt;/li&gt;
&lt;li&gt; Maven 3.6.X&lt;/li&gt;
&lt;li&gt; GraalVM&lt;/li&gt;
&lt;li&gt; Docker&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  JDK
&lt;/h2&gt;

&lt;p&gt;To install JDK go to official website and download the latest version for your operating system.On a linux laptop with Ubuntu you can follow the steps as well&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Open terminal&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;write following commands&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        sudo add-apt-repository ppa:openjdk-r/ppa
        sudo apt update
        sudo apt install open-jdk-8-jdk
        export JAVA_HOME=/usr/lib/jvm/java-8-openjdk
        export PATH=$PATH:$JAVA_HOME/bin
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Check the installed version&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;java -version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Maven 3.6.X
&lt;/h2&gt;

&lt;p&gt;Maven is a build tool it will help us to create builds effectively. To install maven visit maven website and download latest maven. Unzip it and add to path. JAVA_HOME must be set to use maven&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;unzip apache-maven-3.6.3-bin.zip
            export PATH=/opt/apache-maven-3.6.3/bin:$PATH
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  GraalVM
&lt;/h2&gt;

&lt;p&gt;GraalVM is a virtual machine by oracle which enables user to create native images. Native images are faster and has lower memory footprint. GraamVM enable local executables and the binary created by it is independent of JVM it runs faster. It must be noticed that while creating native builds GraalVM do analyse all the classes your code will use at its entire life cycle and the compiles to byte code , the entire process is a bit slow. Run below commands to install GraalVM on linux (ubuntu)&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;            sudo apt-get install build-essential libz-dev zlib1g-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You can install GraamVM community edition or can download enterprise edition from oracle website. If you have a enterprise edition tar file downloaded&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;            tar -xvf graalvm-ee-java11-linux-amd64-19.3.1.tar.gz
            export GRAALVM_HOME=/home/coding/Documents/Softwares/graalvm-ee-java11-19.3.1/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;If you have enterprise edition installed download native jar and run following command&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;            ${GRAALVM_HOME}/bin/gu install native-image --filr native-image-installable-svm-svmee-java11-linux-amd64-19.3.1.jar
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Docker
&lt;/h2&gt;

&lt;p&gt;To install docker at Ubuntu we can use following commands&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;         sudo apt install apt-transport-https ca-certificates curl software-properties-common
         curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
         sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic test"
         sudo apt update
         sudo apt install docker-ce
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For detailed documentation of installation on any platform &lt;a href="https://docs.docker.com/"&gt;https://docs.docker.com/&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Creating User Microservices
&lt;/h1&gt;

&lt;p&gt;In this section we will create our first microservice. We will create user-service which will help us to perform crud operations on user. User service will have mogodb as back end . We will create it using maven command ,Alternatively we can also use generator site i.e &lt;a href="https://code.quarkus.io"&gt;https://code.quarkus.io&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating user-service using maven
&lt;/h2&gt;

&lt;p&gt;Open terminal and type following command.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        mvn io.quarkus:quarkus-maven-plugin:1.2.0.Final:create \
            -DprojectGroupId=com.codingsaint.learning.quarkus \
            -DprojectArtifactId=user-service \
            -DclassName="com.codingsaint.learning.quarkus.UserResource" \
            -Dpath="/user"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;While the above command will only a bare project which you can run using simple maven command. We will be adding the dependencies later , just to understand how can we use quarkus maven extension to add dependencies ,Obviously both steps can be combined together.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;         cd user-service
         mvn quarkus:dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Running application in dev mode
&lt;/h2&gt;

&lt;p&gt;The command to run in dev mode is&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;         mvn quarkus:dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This will start the server in dev mode.In dev mode if you edit the code and do a change it will stop quarkus (not JVM), recompile and start quarkus . This works as live reload and is very helpful in dev mode&lt;/p&gt;

&lt;h2&gt;
  
  
  building native image
&lt;/h2&gt;

&lt;p&gt;Quarkus comes with integrated support for building native images , you can build bare metal or docker based images.To create a image run the below command&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mvn package -Pnative
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;It must be noted that this is a maven profile for building native images and to support this GraalVM must be installed with native jar as mentioned above.   To build native for docker image add&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-Dnative-image.docker-build=true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Adding dependencies
&lt;/h2&gt;

&lt;p&gt;We will be using below command to add dependecies&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mvn quarkus:add-extension -Dextensions=hibernate-validator,mongodb-panache,resteasy-jsonb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;It must be noted that we could have added extensions while creating the project itself adding -D extension , this is just to show , how to add dependencies using maven. You can find list of all the available dependencies at &lt;a href="https://quarkus.io/extensions/"&gt;https://quarkus.io/extensions/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating User entity
&lt;/h2&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        `package com.codingsaint.learning.quarkus;

    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;

    import javax.validation.Valid;
    import javax.ws.rs.*;
    import javax.ws.rs.core.MediaType;
    import javax.ws.rs.core.Response;
    import java.util.UUID;

    @Path("/users")
    public class UserResource {

        private static final Logger LOGGER = LoggerFactory.getLogger(UserResource.class);

        /**
         * Get all of the users
         *
         * @return Response&amp;gt; users
         */
        @GET
        @Produces(MediaType.APPLICATION_JSON)
        public Response users() {
            return Response.ok(User.listAll()).build();
        }

        /**
         * Create the user
         *
         * @param user
         * @return
         */
        @POST
        @Produces(MediaType.APPLICATION_JSON)
        @Consumes(MediaType.APPLICATION_JSON)
        public Response users(final @Valid User user) {
            user.setUserId(UUID.randomUUID().toString());
            user.setActive(true);
            User.persist(user);
            return Response.ok().build();
        }

        /**
         * Update the user
         *
         * @param user
         * @return
         */
        @PUT
        @Produces(MediaType.APPLICATION_JSON)
        @Consumes(MediaType.APPLICATION_JSON)
        public Response update(final @Valid User user) {
            user.update();
            return Response.ok(user).build();
        }

        /**
         * retrieve user based on userId
         *
         * @param userId
         * @return Response */
        @GET
        @Produces(MediaType.APPLICATION_JSON)
        @Consumes(MediaType.APPLICATION_JSON)
        @Path("id/{id}")
        public Response getUserByUserId(@PathParam("id") String userId) {
            User user = User.findByUserId(userId);
            LOGGER.info(" finding user based on userId {}", userId);
            return Response.ok(user).build();
        }

        /**
         * delete user based on userId
         * @param userId
         * @return
         */
        @DELETE
        @Path("id/{id}")
        public Response deleteUser(@PathParam("id") String userId) {
            LOGGER.info(" delete user based on userId {}", userId);
            User.delete("userId",userId);
            return Response.noContent().build();
        }

    }` 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Adding UserResource&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;            package com.codingsaint.learning.quarkus;

            import javax.validation.Valid;
            import javax.ws.rs.*;
            import javax.ws.rs.core.MediaType;
            import javax.ws.rs.core.Response;
            import java.util.UUID;

            @Path("/user")
            public class UserResource {

            @GET
            @Path("/all")
            @Produces(MediaType.APPLICATION_JSON)
            public Response users() {
            return Response.ok(User.findAll().list()).build();
            }
            @POST
            @Produces(MediaType.APPLICATION_JSON)
            @Consumes(MediaType.APPLICATION_JSON)
            public Response users(final @Valid User user) {
            user.setUserId(UUID.randomUUID().toString());
            user.setActive(true);
            User.persist(user);
            return Response.ok().build();
            }
            }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Adding application properties
&lt;/h2&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;            quarkus.mongodb.connection-string = mongodb://localhost:27017
            quarkus.mongodb.database=todo-users
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Running the server
&lt;/h2&gt;

&lt;p&gt;Run the server using below command&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;            mvn quarkus:dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Add a user
&lt;/h2&gt;

&lt;p&gt;Add following curl command or use postman or other software to do a post&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X POST \
            http://localhost:8080/user \
            -H 'Content-Type: application/json' \
            -d '{
            "firstName":"Kumar",
            "lastName":"Pallav",
            "dateOfBirth":"1987-08-05",
            "email":"codingsaint@gmail.com"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}'&lt;/p&gt;

&lt;h2&gt;
  
  
  Retrieve all users
&lt;/h2&gt;

&lt;p&gt;Use a get request &lt;a href="http://localhost:8080/user/all"&gt;http://localhost:8080/user/all&lt;/a&gt; or do a curl as below&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;            curl -X GET \
            http://localhost:8080/user/all \
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You will get a response like&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;            [{

            "id": "5e430af58cd12948d22faa9a",

            "active": true,

            "dateOfBirth": "1987-08-05",

            "email": "codingsaint@gmail.com",

            "firstName": "Kumar",

            "lastName": "Pallav",

            "userId": "10905021-e7c5-43e2-a29e-8a42f69d4fb2"

            }]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>quarkusio</category>
    </item>
  </channel>
</rss>
