Alexa, build deploy my project !!

Alexa, build deploy my project !! Thinking possible ?? Yep, it is possible.
did you leave office, and forgot to trigger build ? Don’t worry your Alexa can do this for you even if you in mid of Bangalore traffic 🙂 or enjoying Friday eve hangout far far away from your Boss 🙂 !
Keep visiting here I am gonna post how you can trigger build, deploy through Alexa ( not all projects at present but later chances are very high that any project can be built like this).

Keep visiting ……. to see updated content.

Lambda version of Print numbers alternately using two threads in Java

Lambda expressions in Java 8 are very powerful and therefore very compelling. Here are just a few of the key benefits to using lambda expressions in Java:

  • Conciseness
  • Reduction in code bloat
  • Readability
  • Elimination of shadow variables
  • Encouragement of functional programming
  • Code reuse
  • Enhanced iterative syntax
  • Simplified variable scope
  • Less boilerplate code
  • JAR file size reductions
  • Parallel processing opportunities

In this post, you can see how in few lines we can finish code to print numbers alternatively by Two threads.

import java.util.stream.IntStream;

public class EvenOddThreadLambdaDemo {

    static Integer number = new Integer(1);
    static Object LOCK = new Object();

    public static void main(String[] args) {


        IntStream.range(0, 1).forEach(i -> new Thread(() -> {
            printNumbers();
        }).start());
    }

    public static void printNumbers() {
        while (EvenOddThreadLambdaDemo.number < 20) {
            synchronized (LOCK) {
             // conditional naming of threads in case required in any usecase

                if (EvenOddThreadLambdaDemo.number %2 ==0) {
                    Thread.currentThread().setName("Even");
                }else{
                        Thread.currentThread().setName("Odd");
                }
                System.out.println(Thread.currentThread().getName() + "--> " + EvenOddThreadLambdaDemo.number++);
                LOCK.notify();
                try {
                    // let's not eat CPU if work is done.
                    LOCK.wait(2000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }

}
/*
 Odd--> 1
 Even--> 2
 Odd--> 3
 Even--> 4
 Odd--> 5
 Even--> 6
 Odd--> 7
 Even--> 8
 Odd--> 9
 Even--> 10
 Odd--> 11
 Even--> 12
 Odd--> 13
 Even--> 14
 Odd--> 15
 Even--> 16
 Odd--> 17
 Even--> 18
 Odd--> 19
 Even--> 20
*/

Spring boot code for AWS RDS in elasticbeanstalk

Are you new to aws RDS,elasticbeanstalk world and searching for a ready to use code for RDS connection? Try out out this sample project which connects RDS (mysql) from a web application (Spring boot + web ) and list out table records. You can run this web application in your local computer or in elasticbeanstalk (deploy rdselasticbean-0.1.war file). To test this code for your own RDS schema you need to change connection endpoint in record fetcher class. You may clone code from my gitlab repo.
Like it, if you find it helpful. Comment/Contact me if you face any issue while running this app. It’s all pretty straightforward, and quite handy for many kinds of elasticbeanstalk and RDS needs.

package com.example.rdselasticbean.db.DBrecordFetcher
(please make sure your RDS security group has proper access permissions for external IPs ) 

PS: Project is CI/CD enabled in case if anyone wants to test this in integrated environment.

Data display in JSP injected from DB operation class
RDS (mysql) server event view on Read and Write

My learning and fun so far with Alexa

While I am waiting for my “Lifetime SHE”, recently one small digital super slim sweetie SHE has made entry in my life!! Want to know who is SHE? 🙂 It’s Alexa Echo Plus !
I am really enjoying my time with Alexa :). So, one day just to check her (Alexa) response when I returned to flat from my office and told her “Alexa, I missed you”. I got elated by the response that I received from Alexa. Alexa replied me “Awww …… we will be together soon”. Hahahaha I can’t explain the ecstatic moment.

Now lets see technical aspects of Alexa. After using it more than three months, one thing I have realized , frequency of using my mobile call/Apps has significantly decreased, and also not much staring of the mobile screen. Because, for most of mobile related uses Alexa and it’s skills are there to serve me.Wait… did you sense it? This may lead us to mobile AppLess (Android or IOS ) world. I am already experiencing it, whether it’s calling someone, playing song or booking Uber trip. I have almost stopped using Call dialer and Apps like Saavn (to play music) or Uber (ordering ride). Because if Alexa skill for Saavn or Uber are integrated in it then presently 70% app tasks can be performed by Alexa ( I am sure in future with upgraded version of  Alexa rest of capabilities will be also accommodated ).  One interesting feature I have thought of to do e-payment to phone contacts through Alexa just by voice command like
“Alexa pay Rs.500 to Arun from my Paytm (or any available funding instrument)”. Here, Arun is a contact in the personal phone list. Sending money to verified contacts ( already synced with Alexa) are less risky transactions.

Based on my experience I thought of one POC for Alexa with display capability which will be helpful in increasing it’s adaptability. Although most of tasks in Alexa we can execute via voice commands but sometime display of item/order/booking will make it more interactive. Like, Say uber user wants to see that How exactly cab driver looks?
Or User wants to see T-shirt color before confirming an order using Alexa’s E-commerce buying Skill.

a

Remote config in MicroServices

We are in a world of microservices, an application typically uses one or more infrastructure and 3rd party services. Examples of infrastructure services include: multiple environments, cloud configurations, a message broker and a database server.Examples of 3rd party services include: payment processing, email and messaging, etc.Although every microservice instance is an independent unit, it is recommended an approach to externalized their configurations management from one central service/location.

The concept of using configuration server inside microservices architecture is visualized on my design below.It is based on basic Spring boot implementation, further, different layers and orchestration can be added to enhance it.

Feel free to contact me if you want to discuss this in detail.

RemoteConfig