Open Policy Agent (OPA) with Spring boot 3

The Open Policy Agent (OPA, pronounced “oh-pa”) is an open source, general-purpose policy engine that unifies policy enforcement across the stack. OPA provides a high-level declarative language that lets you specify policy as code and simple APIs to offload policy decision-making from your software. You can use OPA to enforce policies in microservices, Kubernetes, CI/CDContinueContinue reading “Open Policy Agent (OPA) with Spring boot 3”

Access Jasypt Encrypted Password in Springboot Logback XML

The logback configuration is done very early on in the bootstrap process and if you have encrypted passwords, then those will not be decrypted by default.To fix this, you need to use a custom ConfigurableEnvironment as recommended in method 4 of GitHub – ulisesbocchio/jasypt-spring-boot: Jasypt integration for Spring bootIf using Springboot and @SpringbootApplication annotation, then useContinueContinue reading “Access Jasypt Encrypted Password in Springboot Logback XML”

PermissionDenied in pod running on OpenShift

By default, OpenShift Container Platform runs containers using an arbitrarily assigned user ID. Example: 100068000This provides additional security against processes escaping the container due to a container engine vulnerability and thereby achieving escalated permissions on the host node.How it looks like from inside your running pod. If the application running on the pod attempts toContinueContinue reading “PermissionDenied in pod running on OpenShift”

Publish PostgreSQL Data Changes as Kafka Events using Debezium Connector

Debezium Connector is used to capture row-level changes and publish them as Events to your Kafka Cluster without the need to write custom code.If you have a requirement for (change data capture) in an Event-Driven Architecture, then consider Debezium.Debezium support JSON or you can use a custom converter, for Avro Serialization. The Debezium PostgreSQL connectorContinueContinue reading “Publish PostgreSQL Data Changes as Kafka Events using Debezium Connector”

Connect Conduktor Platform with Kafka Container on Docker

We will spin up a Kafka Container on Docker Desktop and connect to it using Conduktor Platform Application. Setup Kafka Container Create a yaml file named docker-compose-only-kafka.yaml with the following: version: “3” services: zookeeper: container_name: zookeeper image: docker.io/bitnami/zookeeper:3.8 ports: – “2181:2181” volumes: – “zookeeper_data:/bitnami” environment: – ALLOW_ANONYMOUS_LOGIN=yes kafka: container_name: kafka image: docker.io/bitnami/kafka:3.3 ports: – “9092:9092″ContinueContinue reading “Connect Conduktor Platform with Kafka Container on Docker”

Generate AsyncApi Java Objects during Maven Build

The AsyncAPI Specification is a project used to describe and document message-driven APIs in a machine-readable format. It’s protocol-agnostic, so you can use it for APIs that work over any protocol (e.g., AMQP, MQTT, WebSockets, Kafka, STOMP, HTTP, Mercure, etc).The AsyncAPI Specification defines a set of files required to describe such an API. These filesContinueContinue reading “Generate AsyncApi Java Objects during Maven Build”

Generate Avro Schema from Java Object

To generate an Avro Schema from a Java Object, you can use AvroMapper: public static void main(String[] args) throws IOException { AvroMapper avroMapper = AvroMapper.builder() .disable(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY) .addModule(new AvroJavaTimeModule()) .build(); createAvroSchemaFromClass(Universe.class, avroMapper); createAvroSchemaFromClass(Earth.class, avroMapper); createAvroSchemaFromClass(Mars.class, avroMapper); } private static void createAvroSchemaFromClass(Class<?> clazz, AvroMapper avroMapper) throws IOException { AvroSchemaGenerator gen = new AvroSchemaGenerator(); gen.enableLogicalTypes(); avroMapper.acceptJsonFormatVisitor(clazz, gen); AvroSchemaContinueContinue reading “Generate Avro Schema from Java Object”

Docker Image with JDK, Maven, Helm and OpenShift

If you are using CI/CD pipelines and you want to be completely independent of the host that the pipeline is running on (Example GitHub Runner, or Jenkins), then it is best to use a docker image as part of your pipeline instead of trying to install everything on the (GitHub host runner or Jenkins)This requiresContinueContinue reading “Docker Image with JDK, Maven, Helm and OpenShift”

Microprofile ExampleObject externalvalue – Quarkus

The annotation ExampleObject is used to illustrate a particular Content for Request and Response. The documentation states that we can use a URL externalValue for referencing an external JSON file.The json files were located under src\main\resources\META-INF\resources @GET @Path(“/user”) @Produces(MediaType.TEXT_PLAIN) @APIResponses( value = { @APIResponse(responseCode = “200”, content = @Content( mediaType = “*/*”, examples = {ContinueContinue reading “Microprofile ExampleObject externalvalue – Quarkus”

Integration Testing JMS @Transactional with Embedded ActiveMQ

Typically to use the @Transactional annotation in Spring Boot, you must configure transaction management. However, unless you are explicitly configuring a Global Transaction or deploying your application to a Java EE Application server , then the default is Local Transaction Management. Global Transaction Management When a JTA environment is detected, Spring’s JtaTransactionManager is used to manage transactions.ContinueContinue reading “Integration Testing JMS @Transactional with Embedded ActiveMQ”