Skip to main content

Posts

Apache Camel+Snmp Hello World

The following article helps you to get started with the Camel Snmp. Required Jars: I personally did not use Maven for executing this program. I have downloaded all the jars required for this and then executed it. Note: I had to download some jars separately. Not all of them are required.
The following steps should work in most cases: Download camel zip file (https://camel.apache.org/download.html)You may additionally need snmp4j jar. (http://www.snmp4j.org/html/download.html) P.S: Make sure you download the binaries, not the sources ;) Programimport java.util.Date; import java.util.Objects; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.main.Main; import org.apache.camel.main.MainSupport; import org.apache.camel.main.MainListenerSupport; import org.apache.camel.Processor; import org.apache.camel.component.snmp.*; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.CamelCont…
Recent posts

Running multiple shells in the same docker container

The exec way First run a containerdocker run -it test Next, you can use the execGet the docker container id docker ps Run exec on the container id docker exec -it 0ec2333ec307 /bin/bash/ In this way, you can execute multiple commands in the docker container. Alternatively, you can also directly execute the commands you want instead of /bin/bash I have encountered a use case where I have to run two Java programs in the same container. So, I started an interactive shell, which could also be done by directly executing the java command instead of /bin/bash The sshd way, You can have the sshd service up and running so that you can directly start an ssh session to your container. This is a bit more complex method compared to the aforementioned, but you can find it useful if you want access the container from outside of your host machine where there is no docker client. For CentOS, RHELyum install openssh-server systemctl enable sshd systemctl start sshd If you want to have root access, yo…

Method References Example

/* * More can be found at https://java-demos.blogspot.com/ */importjava.util.*;publicclassMethodReferencesDemo{publicstaticvoidmain(Stringargs[]){List<String>namesList=newArrayList<String>();namesList.add("Rama");namesList.add("Sita");namesList.add("Lakshmana");namesList.add("Bharatha");namesList.add("Sathrugna");// call the println() method of System.out object namesList.forEach(System.out::println);// call the static printString method of MethodReferencesDemo class namesList.forEach(MethodReferencesDemo::printString);}publicstaticvoidprintString(Stringst){System.out.println(st);}}

Running Docker apps in VM which need proxy to connect to Internet

For systems, which can't connect to Internet without a proxy Note: If your computer or VM in which you are about to install docker is not connected to Internet directly, then you can use a http(s) proxy. This is the case with most development VMs in the corporates which are generally not exposed to the Internet. Check with your IT team and get a proxy. Once you get a proxy, set it to your VM using the following guide.
Add the following lines to your ~/.bashrc file, so that they will be set when you startup.
vi ~/.bashrc export https_proxy=https://x.x.x.x:3128 export http_proxy=http://x.x.x.x:3128
Sometimes, (as it happened to me), the yum.conf also needs a proxy. Otherwise, you might get a timeout error. Though the curl works, you will face the issue with yum. So add the following line to your /etc/yum.conf file proxy=http://x.x.x.x:3128 Note: Mostly, the port will be 3128. If not, check with your IT team.
Installing Docker CE on CentOS 7.5
It is recommended to do a …

Setting up Confluent Kafka in Docker in Linux (CentOS)

The following guide helps you go through setting up a 3 node kafka cluster using the docker-compose.
Install Docker
Take a look at my post "Running docker apps in VM which needs proxy to connect to Internet"

Downloading the confluent imagesdocker pull confluentinc/cp-kafkadocker pull confluentinc/cp-zookeeper
First, install docker-compose: Docker-compose frees us from manually running each command to set up the cluster. For example, we need not run a command to set up every zookeeper host or kafka-server. Docker-compose (at the time of writing) is a simple binary file which can be downloaded using curl or wget to your computer or VM.
The docker-compose release page contains the instruction to download the docker-compose binary.
Example (at the time of writing)
curl -L https://github.com/docker/compose/releases/download/1.23.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
You need to grant the +x (execute) permission to run the binary using chmod +x
c…

Quick Introduction to Machine Learning

Today, let us talk about machine learning, one of the most popular terms that we are hearing these days. Though the term might be new, it is self explainable.
Machine learning means making the machine to learn. What? The data. Why? To give a better user experience by giving best results. Yes, in machine learning you feed your machine the data that you have and make it learn that data, so that it gives output to users based on that.

What is Apache Storm? How is it related to potato chips?

Previously, we have seen what is Big data, now let us look at a framework that lets you operate with big data. You might have known what is a framework, it is nothing but that which provides you the classes and interfaces to do a particular job easily. The term easily is very important here. It hides all the stuff that you don't need to worry about, by itself taking that burden.