<?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: Srikanth Mokkapati</title>
    <description>The latest articles on DEV Community by Srikanth Mokkapati (@srikanthm9).</description>
    <link>https://dev.to/srikanthm9</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%2F222800%2Fff256f65-d814-4642-b14f-a53be86c55ff.png</url>
      <title>DEV Community: Srikanth Mokkapati</title>
      <link>https://dev.to/srikanthm9</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/srikanthm9"/>
    <language>en</language>
    <item>
      <title>Five Reasons Why you should give Podcasts a Try</title>
      <dc:creator>Srikanth Mokkapati</dc:creator>
      <pubDate>Sat, 06 Mar 2021 09:31:11 +0000</pubDate>
      <link>https://dev.to/srikanthm9/five-reasons-why-you-should-give-podcasts-a-try-hhh</link>
      <guid>https://dev.to/srikanthm9/five-reasons-why-you-should-give-podcasts-a-try-hhh</guid>
      <description>&lt;h2&gt;
  
  
  What is a Podcast?
&lt;/h2&gt;

&lt;p&gt;Podcast is a form of Audio Content, which is recorded by one or more hosts that discusses some topics or events. They can be standalone episodes or a series with recurring themes. They are similar to a YouTube video/series sans Video or a Spoken/Discussed QA or Blog. Podcasts are produced from quite a while (Since 2007 as per Wikipedia) and are constantly gaining traction. They are available with-in Music/Audio streaming platforms like Spotify, Gaana or JioSaavn and also have dedicated Apps in form of Apple/Google podcasts, iHeartRadio, etc. They are reminiscent of Radio Shows of pre-television and Internet era.&lt;/p&gt;

&lt;p&gt;I have been following and listening to several podcasts from around 1.5 years. I find them to be efficient and quite a favorite way to consume media. Through this post, I want to share, why I find them to be so.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Podcasts?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. They are less distracting
&lt;/h3&gt;

&lt;p&gt;Comparing with a YouTube video, podcasts are less distracting. Many of us find ourselves spending hours on YouTube, moving from one recommendation to other without realizing the time spent. This may decrease our productivity, if it becomes a habit. Videos often serve multiple ads, often un-skippable, and require subscriptions otherwise. Podcasts can also have sponsored sections, but they are skippable. Podcasts serve singular topic and recommendation engines are not as much distracting (yet) compared to Video media at present.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. They reduce Screen Time
&lt;/h3&gt;

&lt;p&gt;This is yet again a comparison to Video media. Almost all professions deal with Computers on a daily basis. Most of our entertainment content is also in Video format. If something like news can be consumed through Podcasts, we can reduce our daily screen time, considerably.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Versatile Content
&lt;/h3&gt;

&lt;p&gt;Podcast content is evolving fast and increasingly versatile. You may not be getting pranker Podcasts but, there are alternatives promoting good Comedy. Most of the podcasts are also focused on a niche, providing analysis and in-depth content. When considering the fewer distractions, they provide crisp content with better value.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Promotes Active Listening
&lt;/h3&gt;

&lt;p&gt;Active Listening is an important everyday skill. We must be able to give our concentration to understand and respond to a speaker either in-person or over digital means. Vision makes up the most of our sensory perception. For few people, focus on Images, still or moving, can be a distraction from listening. Immersive podcasts on interesting topics, to self, may promote this kind of attentive listening and understanding.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Travel, Books and Background Noise
&lt;/h3&gt;

&lt;p&gt;These are a bit far-fetched ideas. Podcasts can be Music replacement during commute or long work hours. They can simply be a background noise while cooking or cleaning. Maybe, sometimes, an interesting analysis is better than a repeating the playlist? I also found several Audio books for free on Podcast feeds (some pirated). They did help me re-kindle an interest in book reading.&lt;/p&gt;

&lt;h2&gt;
  
  
  So, No Negatives?
&lt;/h2&gt;

&lt;p&gt;Well, the grass is not always greener on the other side. Podcasts are impressive, but, only the right ones. The community is not yet mature like YouTube, so finding quality content on several niches can be an arduous task and sometimes not possible. Discussion on complex or specific topics may not be feasible without Visuals and also not quite engaging. Also, Most of the time, the content creators do both Audio and Video formats, and release on respective platforms. This is great, yet repetitive.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Podcasts are simply another form of consumption. They have their own audience, creators and enthusiasts. Emerging Social media platforms like ClubHouse are also helping their reach. They can either be helpful or just another distraction, based on the audience. However, if you have not yet checked one, I recommend you to try something in your interest zone. Maybe, it can become one of your favorite pass time.&lt;/p&gt;

</description>
      <category>podcast</category>
      <category>watercooler</category>
      <category>content</category>
    </item>
    <item>
      <title>What is IT Operations Management?</title>
      <dc:creator>Srikanth Mokkapati</dc:creator>
      <pubDate>Sat, 27 Feb 2021 16:23:07 +0000</pubDate>
      <link>https://dev.to/srikanthm9/what-is-it-operations-management-bh</link>
      <guid>https://dev.to/srikanthm9/what-is-it-operations-management-bh</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;With every known Business, Service, Content and also Education going digital, there is an increasing need to observe how these Digital Platforms are running, identify issues as soon as possible and resolve them, to prevent interruptions and not lose Customers or Audience. In this, post, I would like to explain how IT Operations Management comes into the picture and also what we do at OpsRamp, a SaaS ITOM Platform.&lt;/p&gt;

&lt;h2&gt;
  
  
  Observability or Monitoring ?
&lt;/h2&gt;

&lt;p&gt;A quick search of Observability gives us several results on how it differs from Monitoring. Monitoring is collecting the metrics which can give us a picture of the underlying system and present it in a simple, human understandable format, so that we can know how the system is performing. It enables us to gather data on several parameters which can be analyzed to understand the state and performance of system.&lt;/p&gt;

&lt;p&gt;However, Observability is a bit different from this. If Monitoring, can give view and raise issues due to known metrics. Observability is ability to analyze and understand collected data to learn about the unknown changes which may have affected the system. Observability is a requirement this day, where most of the Applications and Infrastructure are loosely coupled and continuously changing be it APIs, Cloud Resources, Containers or server-less Technologies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where does an ITOM fit?
&lt;/h2&gt;

&lt;p&gt;ITOM comes in to picture to regularly Monitor and provide Observability to these complex yet fragile mesh of interconnected and interdependent systems. ITOMs are equipped for providing a high level of systems view and to find and report issues before they can cause service outages or negatively impact businesses and customers. They include, but not limited to, monitoring, reporting, escalating, automating and remediating several issues which arise in Application or IT Infrastructure. They ensure reliability of services.&lt;/p&gt;

&lt;h2&gt;
  
  
  IT Operations Management through OpsRamp
&lt;/h2&gt;

&lt;p&gt;OpsRamp as a SaaS platform enables unified view and management of resources of the whole enterprise at one place. Opsramp is currently a leader in Hybrid Infrastructure Management (both On-Premises and Cloud) with its Automated Discovery and Monitoring capabilities. Opsramp excels in :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Automated Discovery of Cloud Resources and Monitoring.&lt;/li&gt;
&lt;li&gt;  Incident and Event Management and Anticipation through AIOps.&lt;/li&gt;
&lt;li&gt;  Unified View of Networks, Cloud and On-Premises Resources.&lt;/li&gt;
&lt;li&gt;  Integrations with Other Platforms through robust SDKs.&lt;/li&gt;
&lt;li&gt;  RBAC support for Users.&lt;/li&gt;
&lt;li&gt;  Automation of IT Processes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At OpsRamp we continuously strive to enable our Customer Businesses to server their users better. We use highly scalable and modern technologies to drive our Customer capabilities.&lt;/p&gt;

&lt;p&gt;You can find out more about OpsRamp in our official &lt;a href="https://blog.opsramp.com/"&gt;Blog&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;If you are either an Individual or Company looking to manage your Cloud and On-Premises infrastructure, you may be in need of an ITOM. OpsRamp empowers your SREs and help them find and remediate issues and also brings automation into your processes. We, at OpsRamp, are on a continuous endeavor to enable you to serve your Customers better and, take pride in making strides in this field to empower the ever-growing Digital Ecosystem.&lt;/p&gt;

</description>
      <category>operations</category>
      <category>ai</category>
      <category>management</category>
      <category>cloudnative</category>
    </item>
    <item>
      <title>Jackson and Gson - A Handshake 🤝</title>
      <dc:creator>Srikanth Mokkapati</dc:creator>
      <pubDate>Sun, 14 Feb 2021 07:47:37 +0000</pubDate>
      <link>https://dev.to/srikanthm9/jackson-and-gson-a-handshake-2og9</link>
      <guid>https://dev.to/srikanthm9/jackson-and-gson-a-handshake-2og9</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core/2.10.2"&gt;Jackson&lt;/a&gt; and &lt;a href="https://mvnrepository.com/artifact/com.google.code.gson/gson/2.8.6"&gt;Gson&lt;/a&gt; are two of the most popular Java Libraries used for JSON Parsing and API response Serialisation/De-serialisation while using Java and specifically SpringBoot. Both have their own advantages and short-comings. In most cases, it might be sufficient to use a single library. But, what if, you need to use both of them? Continue reading, to find out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use cases
&lt;/h2&gt;

&lt;p&gt;By default, Spring Framework uses Jackson library for parsing Rest API Input and Output. It converts object responses to JSON and request body to Object. And, With simple tinkering to Application properties we can enable Gson parsing.&lt;/p&gt;

&lt;p&gt;However, in some cases, what if we needed the output to be JSON Objects like JSON Array or JSON Object? If we are using Gson, it has straight forward JsonObject and JsonArray Classes which can be used and be request body or response. If we are using Jackson there are no direct classes, but we have JsonNode, ArrayNode etc.. These classes are not very intuitive. If you are to use Gson classes with Jackson parsing in Request Body/Response you will face an exception such as below. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;Could not write JSON: JsonObject; nested exception is com.fasterxml.jackson.databind.JsonMappingException&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This can be on a myriads of internal gson.JsonObject methods/properties, as Jackson is getter/setter based, and on different one each time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Alternatives
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use Java Collections : Use Maps/Arrays/Lists to replace JSON Object/Array Usage. This may keep the code simple, But Business logic may not permit this always.&lt;/li&gt;
&lt;li&gt;Use Other Compatible Libraries : We can use other JSON Libraries such as &lt;a href="https://mvnrepository.com/artifact/net.minidev/json-smart/1.0.9"&gt;JSON - Small and Fast Parser&lt;/a&gt; or Default Package &lt;a href="https://mvnrepository.com/artifact/org.json/json"&gt;Java JSON&lt;/a&gt;. The classes  extend Java Collections, fundamentally parse and hold JSON fields as objects, and hence can be converted without any additional changes. However, there are several performance benchmarks which suggest they are not as fast. At the same time, some of us may prefer the ObjectMapper and Gson classes for Object parsing and Type Conversions and want to keep imports at minimum.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Solution
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Custom Serialisers/Deserialisers&lt;/strong&gt; are powerful extensions in both Jackson and Gson Libraries. In this example, I will present how they can be written for Gson specific objects for Jackson Parsing at API end. The vice-versa is also possible but takes a lot more work considering multiple jackson classes like IntegerNode, NullNode, etc...which extend the Jackson base JSON class &lt;code&gt;TreeNode&lt;/code&gt;. Also, it is simpler to use Gson classes like JsonObject and JsonArray for internal business logic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Classes&lt;/strong&gt; :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gson Classes &lt;code&gt;JsonObject&lt;/code&gt; and &lt;code&gt;JsonArray&lt;/code&gt; are self-explanatory.&lt;/li&gt;
&lt;li&gt;Nulls are denoted by &lt;code&gt;JsonNull&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Primitives(String/Number/Boolean) by &lt;code&gt;JsonPrimitive&lt;/code&gt;. &lt;/li&gt;
&lt;li&gt;All the four classes extend &lt;code&gt;JsonElement&lt;/code&gt; abstract class.&lt;/li&gt;
&lt;li&gt;Writing Custom Serialiser for JsonElement will suffice.&lt;/li&gt;
&lt;li&gt;We have to keep in mind, the JSON supported types and how they are written (quotes/no quotes).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;CustomSerialiser&lt;/strong&gt; :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class CustomGsonObjectSerializer extends JsonSerializer&amp;lt;JsonElement&amp;gt; {
    @Override
    public void serialize(JsonElement value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
        if(value.isJsonObject()) {
            writeJsonObject(value.getAsJsonObject(), gen, serializers);
        } else if (value.isJsonArray()) {
            writeJsonArray(value.getAsJsonArray(), gen, serializers);
        } else if (value.isJsonPrimitive()) {
            writeJsonPrimitive(value.getAsJsonPrimitive(), gen, serializers);
        } else if (value.isJsonNull()) {
            gen.writeNull();
        } else {
            throw new UnsupportedOperationException("Unsupported Gson - JsonElement Type.");
        }
    }

    private void writeJsonPrimitive(JsonPrimitive value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
        gen.writeObject(processJsonPrimitive(value));
    }

    private void writeJsonArray(JsonArray value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
        gen.writeStartArray();
        for (JsonElement element : value) {
            gen.writeObject(element);
        }
        gen.writeEndArray();
    }

    private void writeJsonObject(JsonObject value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
        gen.writeStartObject();
        for(Map.Entry&amp;lt;String,JsonElement&amp;gt; entry : value.entrySet()) {
            gen.writeFieldName(entry.getKey());
            gen.writeObject(entry.getValue());
        }
        gen.writeEndObject();
    }

    private Object processJsonPrimitive(JsonPrimitive value) {
        if(value.isBoolean()) {
            return value.getAsBoolean();
        } else if (value.isString()) {
            return value.getAsString(); //toString method will add extra quotes
        } else if (value.isNumber()) {
            return NumberUtils.createNumber(value.getAsString()); //apache lang3 library
        } else {
            throw new UnsupportedOperationException("UnSupported Gson - JsonPrimitive Type.");
        }
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notable points : &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Code is written taking the types into account and throwing exception incase the type is not supported. With this, we can identify if Gson Library updates are not properly tracked.&lt;/li&gt;
&lt;li&gt;We can also handle Number generation from String separately instead of using Apache Utils, but be careful while handling Big Integers/Decimals.&lt;/li&gt;
&lt;li&gt;Null Values are written to output, while using this code, however we can tinker the if-else conditions to prevent that if needed. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Custom Deserialiser&lt;/strong&gt; :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;I would be against this at present&lt;/strong&gt;, as it is only a sub-optimal solution. We can better go with Java Collections(Maps/Lists) rather than using Gson Classes to keep it simple. It is just in-case there is no other alternative.&lt;/li&gt;
&lt;li&gt;We need separate Deserializers for JsonArray and JsonObject and having a String conversion in between essentially makes it that we are parsing input twice.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For JsonObject :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class CustomJsonObjectDeserializer extends JsonDeserializer&amp;lt;JsonObject&amp;gt; {

    @Override
    public JsonObject deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
        JsonElement jsonElement =  com.google.gson.JsonParser.parseString(p.readValueAsTree().toString());
        if (jsonElement.isJsonNull()) {
            return null;
        } else if (jsonElement.isJsonObject()) {
            return jsonElement.getAsJsonObject();
        } else {
            throw new JsonParseException(p, "Input not a JsonObject");
        }
    }

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

&lt;/div&gt;



&lt;p&gt;For JsonArray :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class CustomJsonArrayDeserializer extends JsonDeserializer&amp;lt;JsonArray&amp;gt; {

    @Override
    public JsonArray deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
        JsonElement jsonElement =  com.google.gson.JsonParser.parseString(p.readValueAsTree().toString());
        if (jsonElement.isJsonNull()) {
            return null;
        } else if (jsonElement.isJsonArray()) {
            return jsonElement.getAsJsonArray();
        } else {
            throw new JsonParseException(p, "Input not a JsonArray");
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Register the Custom Implementations&lt;/strong&gt; :&lt;/p&gt;

&lt;p&gt;We need to register these custom implementations to be used while Http requests are processed. We can use simple Bean Configuration for this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Configuration
public class JacksonConfiguration {


    @Bean
    public ObjectMapper objectMapper() {
        ObjectMapper mapper = new ObjectMapper();
        SimpleModule simpleModule = new SimpleModule();
        simpleModule.addSerializer(JsonElement.class, new CustomGsonObjectSerializer());
        simpleModule.addDeserializer(JsonObject.class, new CustomJsonObjectDeserializer());
        simpleModule.addDeserializer(JsonArray.class, new CustomJsonArrayDeserializer());
        mapper.registerModule(simpleModule);
        return mapper;
    }

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Testing&lt;/strong&gt; :&lt;/p&gt;

&lt;p&gt;Writing a simple Rest API Controller to test this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@RestController
public class SampleRestController {

    @GetMapping("/get")
    public JsonObject status() {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("String", "string");
        jsonObject.addProperty("number", 1);
        jsonObject.addProperty("boolean", "true");
        //any null property added will automatically becomes JsonNull
        jsonObject.add("null", JsonNull.INSTANCE);
        JsonArray jsonArray = new JsonArray();
        jsonArray.add("string");
        jsonArray.add(1.1);
        jsonArray.add(false);
        jsonArray.add(JsonNull.INSTANCE);
        jsonObject.add("jsonArray", jsonArray);
        return jsonObject;
    }

    @PostMapping("/post")
    public JsonObject post(@RequestBody JsonObject jsonObject) {
        return jsonObject;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We get the following output on testing GET endpoint and giving its response as input to POST Endpoint.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "String": "string",
    "number": 1,
    "boolean": "true",
    "null": null,
    "jsonArray": [
        "string",
        1.1,
        false,
        null
    ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Gson and Jackson are two of the most powerful and extensible libraries while handling JSON. Personally, I prefer Gson for Type conversions and internal JSON Logic and Jackson for Http Request handling.&lt;/p&gt;

&lt;p&gt;The Java community maybe biased while choosing between these two. But, I Hope, this may help you incase cross-functionality is in-evitable.&lt;/p&gt;

</description>
      <category>java</category>
      <category>webdev</category>
      <category>tutorial</category>
      <category>json</category>
    </item>
  </channel>
</rss>
