Messaging with NATS and Java

Figure 1. NATS Architecture Component Diagram NATS is a high-performance messaging system that offers simplicity, speed, and scalability. It is particularly suited for building distributed systems and microservices. This article demonstrates how to integrate NATS with Java, showcasing the essential steps to set up, connect, and publish/subscribe to messages. Prerequisites Before diving in, we should ensure to have the following installed: Java Development Kit (JDK) 11 or later. Maven or Gradle for dependency management. Docker (optional). ...

November 26, 2024 · 13 min · 2646 words · Micha Kops

Creating updatable Java Applications using Getdown and the Getdown Maven Plugin

Many programmers have suffered when trying to setup an environment to handle updates for their application without much effort. Some tried Java Web Start for this purpose and many encountered difficulties with this approach. Now there is getdown that aims to replace Java Web Start by offering a simple architecture to handle updates that is fast, realiable and the only thing you need is a normal http server. Though getdown lets us handle our updates really easy it is possible to make this process even easier with the getdown maven plugin. ...

May 27, 2012 · 5 min · 885 words · Micha Kops

Wiring made easy using OSGi Blueprint and Apache Karaf

The OSGi Blueprint Container specification allows us to use dependency injection in our OSGi environment, declarative import and export of OSGi services, registering lifecycle listeners and wiring dependencies into our services with a few lines of XML code. In the following tutorial we’re first building an OSGi bundle classical style and afterwards take a trip into the advantages of the Blueprint specification. Our OSGi container of choice here will be Apache Karaf a lightweight container with a lot of nice features and – of course – blueprint enabled… ...

April 16, 2012 · 9 min · 1705 words · Micha Kops

Hibernate Search Faceting: Discrete and Range Faceting by Example

In today’s tutorial we’re exploring the world of faceted searches like the one we’re used to see when we’re searching for an item on Amazon.com or other websites. We’re using Hibernate Search here that offers an API to perform discrete as well as range faceted searches on our persisted data. Maven Dependencies Needed For simplicity’s sake am I going to use an HSQL database for persistence, in addition the dependencies for hibernate-entitymanager and hibernate-search (of course) should be added to your pom.xml ...

March 26, 2012 · 5 min · 986 words · Micha Kops

Snippet: Mixing Scala, Java in a Maven Project

Having just returned from the Atlassian Camp 2012 I just toyed around with Java and Scala and wanted to share the following snippet that demonstrates how to mix code from both languages in a Maven project using the maven-scala-plugin. Setting up the Maven Project First create a new Maven project in your IDE or by running mvn archetype:generate. In the next step, add the dependency for scala-library and the scala maven repositories to your pom.xml and hook the maven-scala-plugin to Maven’s lifecycle. My pom.xml finally looks like this one: ...

March 23, 2012 · 2 min · 327 words · Micha Kops

Using the Android Fragment API in a Tablet App

Since I got a new tablet running Android 4.0 aka ice cream sandwich I wanted to play around a bit with the fragments API and creating an application for a tablet. In the following tutorial, we’re going to build an application that renders several articles from a popular tech blog (just kidding) in a web view. What to build We’re going to build an application that is able to display web links in the left section of the screen and when clicked, displaying the corresponding website content in the right section of the application screen. ...

March 18, 2012 · 7 min · 1355 words · Micha Kops

Android Widget Tutorial: Creating a screen-lock Widget in a few steps

In today’s Android tutorial we’re going to take a look at Android’s Widget API and how to make a widget interact with a service using intents. Figure 1. hasCode Android Widget Tutorial Logo We’re going to create a fully functional application that allows us to enable or disable our smartphone’s screen lock settings using a widget that can be placed on our home screen. Finally, I am going to show how to use a smartphone to test and debug our application and connect it to the IDE. ...

October 6, 2011 · 10 min · 2082 words · Micha Kops

Screenscraping made easy using jsoup and Maven

Sometimes in a developer’s life there is no clean API available to gather information from a web application .. no SOAP, no XML-RPC and no REST .. just a website hiding the information we’re looking for somewhere in its DOM hierarchy – so the only solution is screenscraping. Screenscraping always leaves me with a bad feeling – but luckily there is a tool that makes this job at least a bit easier for a developer .. jsoup to the rescue! ...

August 30, 2011 · 3 min · 526 words · Micha Kops

Creating Portlets using Java Server Faces 2 and Liferay

Portlets are a common technology to create plug&play components for modern web applications and are specified by the Java Community Process in several specification requests. In the following tutorial we’re going to learn how to create custom portlets and how to deploy and embed them in Liferay, the popular open-source enterprise portal. In addition we’re taking a look at inter-portlet-communication and how to create portlets using annotations. Finally we’re building a portlet-state-aware Java-Server-Faces portlet using the jsf-portlet-bridge mechanism. ...

July 19, 2011 · 14 min · 2783 words · Micha Kops

Message Driven Beans in Java EE 6

Message Driven Beans are no new concept due to the fact that they exist since EJB 2.0 but in Java EE 6 and the EJB 3.0 specification it is even more fun to use them. In this tutorial we’re going to take a look at the specification and create an example application that transfers some objects via the Java Message Service to a Message-Driven Bean deployed on a GlassFish application server. ...

June 5, 2011 · 12 min · 2430 words · Micha Kops