Prabhat Kashyap – Scala-Trek

I writes Scala Code

Join Semantics in Kafka Streams — October 16, 2017

Join Semantics in Kafka Streams


Image result for apache kafkaIntroduction to core concepts:

Apache Kafka is a distributed streaming platform which enables you to publish and subscribe to a stream of records also letting you process this stream of records as it occurs.

Kafka Streams is a client library used for building applications and microservices, where the input and output data are stored in Kafka clusters.

Interface KStream<K, V> is an abstraction of record stream of key-value pairs. It is defined from one or more Kafka topics that are consumed message by message or as a result of KStream transformation.

Interface KTable<K, V> is an abstraction of changelog stream from a  primary-keyed table. Each record in this stream is an update on the primary keyed table with the record key as the primary key. Like KStreams, it is defined from one or more Kafka topics that are consumed message by message or as a result of a KTable transformation.

View original post 477 more words

Getting started with Ethereum — August 22, 2017

Getting started with Ethereum



What is Ethereum?

Ethereum is an open-source blockchain platform that lets anyone build and use decentralized applications that run on blockchain technology. It is an open-source project created by Vitalik Buterin.

How is it different from Bitcoin?

Bitcoin is not capable of performing calculations that didn’t fit into his limited scripting language.

Satoshi Nakamoto, the creator of bitcoin, did not design it to send anything more than few kilobytes of data per transaction believing that limiting the functionality would improve the security of the system.

But unlike Bitcoin, Ethereum was designed as the one that fits a virtual machine (the EVM), a Turing-complete language(Solidity), a token (ETH), and fuel (gas) to power every transaction in its network. This combination allows to create complex programmatic computational instructions or as we call them smart contracts and decentralized applications or DApps.

How does it work?

The basic unit of Ethereum is account. Accounts…

View original post 388 more words

Starting with Blockchain Chaincode using Golang — June 20, 2017

Starting with Blockchain Chaincode using Golang


Chaincode, or a smart contract is a fragment of code written in supported languages like Java or Go that is deployed onto a network of HyperLedger Fabric peer nodes.

Chaincodes run network transactions which are validated and then appended to the shared ledger. In simple terms, they are encapsulation of business network transactions in a code.

In this blog, we will learn how to develop chaincode with GoLang for a blockchain network based on Hyperledger Fabric v0.6.

Development environment required for Chaincode development:

  • Go Go 1.6 install
  • Hyperledger Fabric
    • Use the following command to install Hyperledger fabric 0.6:

git clone -b v0.6

Implementing the chaincode interface

View original post 237 more words

Simple Java program to Append to a file in Hdfs — June 15, 2017

Simple Java program to Append to a file in Hdfs


In this blog, I will present you with a java program to append to a file in HDFS.

I will be using Maven as the build tool.

Now to start with-

First, we need to add maven dependencies in pom.xml.

Now we need to import the following classes-

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

View original post 338 more words

Message Broker in Lagom using Kafka — April 17, 2017

Message Broker in Lagom using Kafka


What is Lagom?

Lagom framework helps in simplifying the development of microservices by providing an integrated development environment. This benefits one by allowing them to focus on solving business problems instead of wiring services together.

Lagom exposes two APIs, Java and Scala, and provides a framework and development environment as a set of libraries and build tool plugins. The supported build tools with Lagom are Maven and sbt. You can use Maven with Java or sbt with Java or Scala.

Message Broker Support in Lagom

If there is a synchronous communication between microservices, it implies that both the sender and the receiver have to be running at the same time. Now this may lead to consistency problems if messages get missed, and can result in a system that is brittle, where a failure in one component can lead to failure of the complete system.

As a solution to this, one can use an infrastructure component…

View original post 372 more words

Introduction to database migrations using Flyway — January 26, 2017
Getting Started with Actors [Akka in a Nutshell #2] — January 10, 2017

Getting Started with Actors [Akka in a Nutshell #2]


Hierarchical Structure

Actors are objects which encapsulate state and behavior, they communicate by exchanging messages. We can consider an actor as a person.

Like a software development team, actors form hierarchies. In a team there is a project manager who takes requirements from client and distributes it over to different team leads. Then those team leads further distribute the tasks to other team members.Team members after finsihing their tasks, report to their team lead about the status.

Similarly, an actor might wants to split up a task into smaller tasks. For that actor creates child actors and if by any means child actor is unable to execute successfully then it will send a corresponding failure message to it’s parent where it is created from.

Actor System

An actor system manages the resources it is configured to use in order to run the actors which it contains.

The actor system as…

View original post 735 more words