This is second in a series of posts exploring service to service call patterns in some of the application runtimes on Google Cloud. The first in the series explored service to service call patterns in GKE. This post will expand on it by adding in a Service Mesh, specifically Anthos Service Mesh, and explore how the service to service patterns ...
Read More »Home »
Service to Service call patterns in Google Cloud – GKE
This is a series of posts that will explore service to service call patterns in some of the application runtimes in Google Cloud. This specific post will explore GKE without using a service mesh and the next post will explore GKE with Anthos Service Mesh. Set Up The set-up is simple, two applications – caller and producer are hosted on ...
Read More »Kotlin “Result” type for functional exception handling
In a previous post I had gone over how a “Try” type can be created in Kotlin from scratch to handle exceptions in a functional way. There is no need however to create such a type in Kotlin, a type called “Result” already handles the behavior of “Try” and this post will go over how it works. I will be ...
Read More »Kotlin: Type conversion with adapters
In this post we will learn how we can use Kotlin extension functions to provide a simple and elegant type conversion mechanism. Maybe you have used Apache Sling before. In this case, you are probably familiar with Slings usage of adapters. We will implement a very similar approach in Kotlin. Creating an extension function With Kotlins extension functions we can ...
Read More »Deriving a Kotlin “Try” type
Functional programming languages like Scala often have a type called “Try” to hold the result of a computation if successful or to capture an exception on failure. This is an incredibly useful type, allowing a caller to pointedly control how to handle an exceptional scenario. In this post I will try and create such a type from scratch. As an example, ...
Read More »Kotlin dependency injection with Koin
Dependency injection is a common technique in today’s software design. With dependency injection we pass dependencies to a component instead of creating it inside the component. This way we can separate construction and use of dependencies. In this post we will look at Koin, a lightweight Kotlin dependency injection library. Koin describes itself as a DSL, a light container and ...
Read More »Jackson Kotlin extension and reified types
Jackson Kotlin module library is a pleasure to use. It greatly simplifies gnarly code, specifically one’s involvingTypeReference. Consider a sample json which looks like this: 1 2 3 4 5 { "a" : ["b", "c"], "b" : ["a", "c"], "c" : ["a", "b"] } This content can be represented as a “Map<List<String>>” type in Java. So now, if I were ...
Read More »Top “n” using a Priority Queue
If you ever need to capture the smallest or largest “n” from a stream of data, the approach more often than not will be to use a simple data-structure called the Priority Queue. Priority Queues do one thing very well – once a bunch of data is added, it can return the lowest value (or the highest value) in constant ...
Read More »Kotlin – Convert List to Map Examples
1. Overview In this tutorial, We’ll learn how to convert the List to Map in Kotlin programming. Let us explore the different ways to do it. 1. Overview In this tutorial, We’ll learn how to convert the List to Map in Kotlin programming. Let us explore the different ways to do this conversion. Kotlin provides a set of methods for ...
Read More »