GraphQL Day 004 : Subscriptions

So far we have seen Queries and Mutations in GraphQL. It is now time to look into third and final key component of the triage - Subscriptions. Subscriptions allow GraphQL servers to send real time updates to subscribed clients when particular events occur. This allows clients to support real-time functionality by having the servers push the updates … Continue reading GraphQL Day 004 : Subscriptions

Running MongoExpress in Docker : Solving the connection issue

In this post, we will attempt to run MongoDb and Mongo Expres on docker. That doesn't look challenging, then why a post dedicated to the same ? This is because of one common mistake that developer tends to do (oh yes, I made the mistake) and end up wondering why it doesn't work as desired. Let us write our … Continue reading Running MongoExpress in Docker : Solving the connection issue

Conditional Serialization in Protobuf

In this blog post, we will discuss how to conditionally serialize a property when using Protobuf Serialization. We are using the Protobuf-net library by Marc Gravell. I will attempt to use the same example class/scenario which I had previously used for Conditional Serialization in Json since it bears a lot of similarity. [ProtoContract] public class User { [ProtoMember(1)] public … Continue reading Conditional Serialization in Protobuf

Hidden gems in List Pattern

In this blog post, we will explore few hidden gems in list patterns , which was introduced with C# 11. List Pattern allows us to check patterns in arrays or list. Assign Variable You can assign variables using pattern, provided the pattern matches. For example, var arr = new [] {1,2,3,4,5}; if(arr is [_,2,var third,..] match) { … Continue reading Hidden gems in List Pattern

Compare JSON Arrays

How do you compare two similar JSON array set ? I bet that is a scenario you might have across atleast once in your developer life. Let us say you have following two sets of JSONs. Json Set 1 [ { "SourceLocation":"England", "DestinationLocation":"Spain", "DeliveryDate":"9/12" }, { "SourceLocation":"England", "DestinationLocation":"Germany", "DeliveryDate":"9/12" } ] Json Set 2 [ … Continue reading Compare JSON Arrays

The required modifier : Understand the limitations

C# 11 introduced the required modifier, which indicates that the applied peroperties and fields should be initialized by all available constructors or using object initializer. We learned more about the modifier in our earlier post. In this post, we take a look into a limitation of the functionality. Consider the following code. publicclassFoo { public required string Name {get;set;} public … Continue reading The required modifier : Understand the limitations

K-Sum – A generalized solution

In this blog post, we will attempt to address the 4-Sum problem from Leet code using the generic approach of K-Sum. Let us state the official definition of the problem. Given an array nums of n integers, return an array of all the unique quadruplets [nums[a], nums[b], nums[c], nums[d]] such that: 0 <= a, b, … Continue reading K-Sum – A generalized solution

Generate Password Hash for RabbitMq

In the previous post, we explored how to use docker compose to per-initialize queues in a docker container. The configuration files also provided a way to initialize users. Each of the users where configured with a password, which is given in the configuration file as a hash value comprising of a randomly generated 32 bit salt and … Continue reading Generate Password Hash for RabbitMq

Circuit Breaker with Ocelot & Polly – Part 2

In the previous blog post on Circuit Breaker with Ocelot And Polly, we saw how we could use the Ocelot library's inbuilt support for Polly to build Circuit breakers for handling timeout errors from the downstream services. In this blog post, we will address, how we could trigger a circuit breaker when the downstream service returns … Continue reading Circuit Breaker with Ocelot & Polly – Part 2