Showing posts with label adambien. Show all posts
Showing posts with label adambien. Show all posts

Saturday, May 5, 2018

JavaEE 8 Archetype for microservice Airhacks Adam Bien

JavaEE 8 Archetype is https://github.com/AdamBien/javaee8-essentials-archetype

it uses docker, so I will try it on Linux VM.

mvn archetype:generate -Dfilter=com.airhacks:javaee8-essentials-archetype

I enter: 1,2, org.pierre, pvmicroservice, Y

cd pvmicroservice/

mvn package
copy the war from target to wildfly deployment folder

http://localhost:8180/pvmicroservice/resources/ping

now open the Dockerfile, change glassfish into wildfly, anc change second line adding chown:
FROM airhacks/wildfly
COPY --chown=serveradmin:serveradmin ./target/pvmicroservice.war ${DEPLOYMENT_DIR}


mvn clean install && docker build -t airhacks/pvworkshops .
docker run -d --name workshops -p 8082:8080 airhacks/pvworkshops:latest
docker exec -u root -ti workshops bash
docker logs workshops


http://localhost:8082/pvmicroservice/resources/ping


docker rm -f workshops




It talks for a while about some patterns implemented by Eclipse Microprofile https://projects.eclipse.org/proposals/eclipse-microprofile

This is the Telemetry metrics project https://github.com/eclipse/microprofile-metrics




Monday, December 11, 2017

Adam Bien memorable quote about maintainability

https://youtu.be/O1VTx0psUgo?t=569

For me how I see the JAX-RS movement is the following

no one cares of my clients about JAX-RS Rest or whatever.

What we would to have is to build the application quickly and maintainable

So when is the application maintainable?

In my eyes it’s maintainable in this case if you understand the domain concepts

and you forget the app for 2 years

and after 2 years you return to the project

and you still remember the concepts

you should quickly be able to understand the app, introduce new features, and fix bugs.

When is it possible?

This is only possible in case the domain concepts and the business logic immediately becomes visible to you.

The more it’s obfuscated with strange patterns, the less maintainable your application becomes.


So regardless whether you use Spring Boot, Java EE or whatever, what you should get at the end of the day,

If you know the domain concepts and you look at the URIs, you should be immediately identify what is going on there.

So this is the only quality for which I am interested in implementing JAX RS or Business Services.



Wednesday, November 29, 2017

Adam Bien on Lambda and Runnable


Java 8 Basics: Method References from AdamBien on Vimeo.



This is my code:




public class TestRun {
 public static void main(String[] args) {
  TestRun testRun = new TestRun();
  testRun.method1();
  testRun.method2();
  testRun.method3();
  testRun.method4();
 }

 
 /**
  * Old Java school
  */
 public void method1() {
  Runnable runnable = new Runnable() {
   @Override
   public void run() {
    System.out.println("ciao1");

   }
  };
  new Thread(runnable).start();
 }

 /**
  * Runnable's only method has no input parameters and only 1 method, 
  * it's a Functional Interface https://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html 
  * so we provide method implementation inline (lambda)
  */
 public void method2() {
  Runnable runnable = () -> {
   System.out.println("ciao2");
  };
  new Thread(runnable).start();
 }
 
 /**
  * Syntactic sugar, since there is no parameter we omit the () notation altogether
  */
 public void method3() {
  Runnable runnable = () -> System.out.println("ciao3");
  new Thread(runnable).start();
 }
 
 /**
  * We provide the method (lambda) as a reference
  */
 
 public void method4() {
  Runnable runnable = this::display;
  new Thread(runnable).start();
 }
 
 
 public void display() {
  System.out.println("ciao4");
 }
}



Tuesday, November 14, 2017

Adam Bien The Great airhacks links

Listening to Adam Bien SEMINAL videos, I will write down some links:


http://www.adam-bien.com/roller/abien/entry/the_4th_airhacks_io_question


http://openjpa.apache.org/jest-usage.html maps JPA to REST calls

https://wiki.eclipse.org/EclipseLink/Examples/JPARS/Simple JPA RS from EclipseLink, same as JEST


https://github.com/p6spy/p6spy database interceptors


Ping https://github.com/AdamBien/ping

Floyd https://github.com/AdamBien/floyd

Watchdock https://github.com/AdamBien/watchdock/ and http://www.adam-bien.com/roller/abien/entry/watchdock_er_v0_0_1

I try to do so :


sudo systemctl start dockerd -H tcp://0.0.0.0:5555 -api-enable-cors
ssh: Could not resolve hostname tcp://0.0.0.0:5555: Name or service not known
Could not watch jobs: Connection reset by peer


Mystery!