Cloud development, Logging Frameworks, Transactions, Micro Services, Testing, ETags, JPA, BCE, Batch on AWS, Exception Handling, FlywayDB, Lombok, CDI events--or 87th airhacks.tv

The 87th airhacks.tv (and the first from http://youtube.com/c/bienadam/):

"Cloud development, logging frameworks, transactions and micro services, unit-, integration-, system testing, ETags and JPA, Boundary Control Entity pattern, long running processes in the cloud, exception handling, FlywayDB, lombok, CDI events"
is available:

See you every first Monday of the month at https://airhacks.tv 8pm CET (UTC+1:00).

Show is also announced at: meetup.com/airhacks.

Any questions left? Ask now: https://gist.github.com/AdamBien/8b2b52ca341285c15de7d4a9257f3f54 and get the answers at the next airhacks.tv.

How Hudson and Jenkins happened--an airhacks.fm podcast

Subscribe to airhacks.fm podcast via: spotify| iTunes| RSS

The #143 airhacks.fm episode with Kohsuke Kawaguchi (@kohsukekawa) about:
PCs in Japan, Java, working for Sun Microsystems, Glassfish, Java EE / J2EE, XML implementing Jenkins, starting Hudson
is available for

Lombok, Clouds, Transactions, Events, Batch, Exceptions, Clusters, BCE--or 87th airhacks.tv

Questions and topics (details: https://gist.github.com/AdamBien/38e1754782c901f5d63e45968f3df610) for the very first airhacks.tv on youtube https://www.youtube.com/c/bienadam/live:

  1. How to microprofile metrics in Kubernetes cluster
  2. Authentication and microprofile metrics
  3. Two microservices, one database ...and transactions
  4. Where to put business logic in the BCE pattern?
  5. A cloud development environment
  6. Interesting ClassCastExceptions
  7. Stateless EJB vs. Singleton EJB, and is there a case of pooling?
  8. Code reuse with WARs, without EARs
  9. Bulkheads, threads, connections ...and browser tabs
  10. java.util.Logger vs. java.lang.Logger vs. slf4j and log4j
  11. How important are unit tests
  12. MicroProfile Rest client and receiving status codes without exceptions
  13. JSON Patch and BCE in the frontend: https://github.com/adambien/bce.design
  14. ETags with JPA entities
  15. Boundaries, BCE and, JAX-RS and @Transactional
  16. Long running processes on AWS
  17. Singleton in the cloud
  18. Exception handling and retries with MicroProfile rest client
  19. What is FlywayDB?
  20. Lombok: yes or no?
  21. What are the differences between integration test, smoke test, system test and unit test?
  22. A command pipeline with CDI events?
  23. Exception handling in Jakarta EE applications
  24. CDI Events with Jakarta EE

See you every first Monday of the month at https://airhacks.tv 8pm CET (UTC+1:00). Show is also announced at: meetup.com/airhacks.

Watch the live stream on https://www.youtube.com/c/bienadam/live.

Any questions left? Ask now: https://gist.github.com/AdamBien/38e1754782c901f5d63e45968f3df610 and get the answers at the next airhacks.tv.

Scroll snapping with plain CSS properties: scroll-snap-type and scroll-snap-align

Enforcing "snapping" with the CSS property: scroll-snap-type on the scroll container and scroll-snap-align on the container's children:

Serverless with Java EE, Jakarta EE, MicroProfile and a Kubernetes Operator--an airhacks.fm podcast

Subscribe to airhacks.fm podcast via: spotify| iTunes| RSS

The #142 airhacks.fm episode with Rudy De Busscher (@rdebusscher) about:
fourier transform on tomatoes, Java EE / Jakarta EE the platform of choice, MicroProfile and from Payara Cluster to serverless Kubernetes Operator and Payara Cloud
is available for

A minimalistic "Plain Web Standards" template (PWS) was released

A plain and minimalistic "Plain Web Standards" template (PWS) was released: https://github.com/adambien/pws.

To create a project you have to:

  1. Install browsersync
  2. git clone https://github.com/AdamBien/pws
  3. cd app
  4. Perform: browser-sync src -f src --no-notify

This minimalistic "quickstarter" is used in most of my explanatory web screencasts https://www.youtube.com/playlist?list=PLxU9yM-_yPs_B-kaWK0c44KgyWAre4hCH and POCs.

For more serious projects checkout the Web Components, lit-html and redux quickstarter.

java.util.Objects: Useful Array Index Check Methods

Objects ships with useful array index check methods:

checkIndex: Checks if the index is within the bounds of the range from 0 (inclusive) to length (exclusive).


@Test
public void checkIndex() {
    var index = 1;
    var length = 2;
    var actual = Objects.checkIndex(index, length);
    assertEquals(index, actual);

    assertThrows(IndexOutOfBoundsException.class, () -> {
        Objects.checkIndex(2,2);
    });
}

A violation (e.g. Objects.checkIndex(2, 2)) yields a throws an instance of IndexOutOfBoundsException with the following message: java.lang.IndexOutOfBoundsException: Index 2 out of bounds for length 2

checkFromToIndex: Checks if the sub-range from fromIndex (inclusive) to toIndex (exclusive) is within the bounds of range from 0 (inclusive) to length (exclusive).


@Test
public void checkFromToIndex() {
    var fromIndex = 0;
    var toIndex = 0;
    var length = 4;
    var actual = Objects.checkFromToIndex(fromIndex, toIndex, length);
    assertEquals(fromIndex, actual);

    assertThrows(IndexOutOfBoundsException.class, () -> { 
        Objects.checkFromIndexSize(0, 5, 4);
    });
}    

checkFromIndexSize: Checks if the sub-range from fromIndex (inclusive) to fromIndex + size (exclusive) is within the bounds of range from 0 (inclusive) to length (exclusive).


@Test
public void checkFromIndexSize() {
    var index = 0;
    var size = 3;
    var length = 4;
    var actual = Objects.checkFromIndexSize(index, size, length);
    assertEquals(index, actual);

    assertThrows(IndexOutOfBoundsException.class, () -> {
        //1 + 4 >= 4
        Objects.checkFromIndexSize(1, 4, 4);
    });
}

Receiving Server Sent Events (SSEs) with Plain Java SE

Receiving Server Sent Events (SSE) with plain Java 11+:

The stream of string lines is "reactive", you will receive the events "on the go":


import java.net.URI;
import java.net.URISyntaxException;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse.BodyHandlers;

import org.junit.jupiter.api.Test;

public class HttpClientSSETest {

    @Test
    public void receiveEvents() throws URISyntaxException, IOException, InterruptedException {
        var uri = new URI("http://localhost:8080/sse");
        var client = HttpClient.newHttpClient();
        var request = HttpRequest.newBuilder(uri).GET().build();
        var lines = client.send(request, BodyHandlers.ofLines()).body();
        lines.forEach(System.out::println);
    }
}    

The project was created with the "hopefully shortest Java 16 starter". and the SSEs were sent with "mocking backend for frontends" aka mockend.

FN Java, Java on Java and GraalVM features--an airhacks.fm podcast

Subscribe to airhacks.fm podcast via: spotify| iTunes| RSS

The #141 airhacks.fm episode with Shaun Smith (@shaunmsmith) about:
serverless Java, lambdas, functions, micronaut data, JPA, openJDK, Espresso, GraalVM Community vs Enterprise performance and features
is available for

MicroProfile Metrics, Micrometer and Quarkus--an airhacks.fm podcast

Subscribe to airhacks.fm podcast via: spotify| iTunes| RSS

The #141 airhacks.fm episode with Shaun Smith (@shaunmsmith) about:
serverless Java, lambdas, functions, micronaut data, JPA, openJDK, GraalVM Community vs Enterprise performance and features
is available for

Online Workshops
...the last 150 posts
...the last 10 comments
License