Developing for Android with Pascal and Eclipse

Phil Hess posted a step-by-step introduction to Android development using Free Pascal and the Eclipse IDE.

With this solution, developers have access to practically the entire Eclipse and Android toolsets. This includes not only the complete set of Android widgets and a graphical designer for laying them out, but also access to the complete Android runtime. The Eclipse IDE will also build the executable and launch the Android emulator (using Run As | Android Application).

You use a Java class the same way you use Pascal classes. For example, to use the SQLiteDatabase class to open a SQLite database, you would write something like this:

var
  FileName : string;
  Db       : ADSSQLiteDatabase;
begin
  FileName := 'mydb.sqlitedb';
  Db := ADSSQLiteDatabase.openDatabase(FileName, nil, ADSSQLiteDatabase.OPEN_READONLY);
  ...

This code example shows the Pascal source for an Android activity:

Firebird Database Events and Message-oriented Middleware (part 2)

Firebird developers can use Firebird events to notify clients about changes in database record data. In the previous post, I showed and discussed some limitations of Firebird events. This post presents a solution based on message-oriented middleware.

The solutions in the first post used server-side logic in the Firebird database metadata, implemented with Firebird’s procedural language (PSQL). Information which can not be passed within Firebird events, such as the record ID of the new purchase order, can be stored in helper tables which then must be read by the database clients. So from a technical view, these solutions only replace the timer-triggered client-pull with event-triggered client-pull. This is a small step forward, at the price of increased complexity of database metadata.

A new strategy: implementing the event notification on the client side

Obviously, the client application which inserts a new purchase order could also send notifications to the other clients. The advantage would be that server-side PSQL code can be replaced by code written in your client-side programming language (Delphi/Free Pascal, C#, …). The PSQL code in the server-side solution looked like this:

  CREATE TRIGGER PURCHASE_ORDER_INSERT FOR PURCHASE_ORDER AFTER INSERT
  AS
  BEGIN
    POST_EVENT 'purchase_order_table_updated';
  END

If we implement notifications in the client side application, similar code has to be be executed when a new order record has been inserted in the order table, using an inter-process communication method. The event notification code could look like this:

procedure TAppDataModule.PurchaseOrderAfterPost(DataSet: TDataSet);
var
  Notification: INotification;
begin
  Notification := NotificationService.CreateNotification(PURCHASE_ORDER_TABLE_UPDATED);
  Notification.SetIntProperty(PURCHASE_ORDER_ID, PurchaseOrderID.AsInteger);
  NotificationService.Send(Notification);
end;

But advanced features like load balancing, or for notifying clients which currently are not listening, would need a high amount of custom code. Another difficult task would be the integration of clients or other systems written in an other programming languages (a PHP based order entry web app for example) – their integration with your application would only be possible after porting the notification system.

Continue reading

Firebird Database Events and Message-oriented Middleware (part 1)

Firebird developers can use Firebird events to notify clients about changes in database record data. In this article, I will show and discuss some limitations of Firebird events and compare possible workarounds with a solution based on message-oriented middleware.

How should I implement “server push” for new data, instead of “client pull”?

For this article we assume a common business use case:

  • a two-tier client-server application
  • one client creates new records of type “purchase order”
  • other clients need to be notified about new “purchase order” records

In this scenario, repeated pulling data from the “purchase order” table causes network traffic from all client workstations – even if there are no new orders at all, and too many clients would cause network and/or server resource overload. But being a two-tier architecture, there is no service layer or application server between database and the client software which could handle the notifications. Our conclusion is that we need server side ‘push’ notifications, which will only cause network traffic when there is new data.

Continue reading

Preliminary Open MQ 5.0 released

A preliminary release of the open source message broker OpenMQ 5.0 has been released. Open MQ 5 will support JMS 2.0 and is planned to be included with GlassFish Server, Open Source Edition 4.0. A commercial client library for Delphi and Free Pascal is available from Habarisoft.

HornetQ 2.3.0.Beta released

JBoss Community released HornetQ 2.3.0.Beta, which contains HA replication as well as many other fixes and enhancement. Apart from a few minor fixes and documentation updates this is what will go into 2.3.0.Final and is what will be in JBoss AS 7.2. HornetQ now also supports STOMP 1.1. A Delphi and Free Pascal client library for HornetQ is available.

Habari Client for ActiveMQ 3.2 released

September 12, 2012 – Habarisoft today released version 3.2 of Habari Client for ActiveMQ, a library which provides access to Apache ActiveMQ, the open source messaging system. With this library, Delphi and Free Pascal developers can build integrated solutions, using the peer-to-peer or the publish and subscribe communication model. ActiveMQ is also the default Java Message Service (JMS) provider in the open source Java EE server Apache Geronimo.

New in version 3.2:

  • STOMP 1.1 support
  • tested with Apache ActiveMQ 5.5.1, 5.6.0 and 5.7-SNAPSHOT
  • tested with Indy 10.5.9 revision 4806
  • upgraded to Synapse build 40
  • many internal code improvements / refactorings
  • improved and extended documentation
  • Free Pascal / RTTI suppression fix
  • Free Pascal / CommandLineSupport unit fix
  • fixes for potential memory leaks
  • log hint “Closing a connection for you”

For special offers (bundles and discount coupon codes) please visit http://mikejustin.wordpress.com/

Home page and demo download:
http://www.habarisoft.com/habari_activemq.html

Getting Started Guide (PDF):
http://www.habarisoft.com/download/HabariActiveMQGettingStarted.pdf

Online API documentation:
http://www.habarisoft.com/habari_activemq/3.2/docs/api

Discover ActiveMQ brokers with Delphi and IP Multicast

This article shows how Delphi can use IP multicast to find Apache ActiveMQ message brokers in the local network.

With the code below, a Delphi application can list all ActiveMQ brokers, see their status, and get their IP address. This allows for dynamic configuration of client applications (built for example with Habari Client for ActiveMQ), where systems do not need to know the location of message brokers. It also allows automatic handling of broker failures or maintenance windows without intervention.

Example output

The output shows that a broker was found, running on the computer ‘my-PC’. The URL part indicates that the broker provides a connector for the OpenWire protocol on port 61616.

Waiting for broker discovery messages ...
Brokers found:
default.ActiveMQ-4.alive.%localhost%tcp://my-PC:61616

Continue reading

Habari Client for HornetQ 1.8

August 21, 2012 – Habarisoft is pleased to announce release 1.8 of Habari Client for HornetQ.

With this library, Delphi and Free Pascal developers can build integrated solutions, connecting applications using the peer-to-peer and the publish and subscribe communication model.

New in version 1.8:

  • STOMP 1.1 support
  • NACK (negative ACK) support
  • tested with HornetQ 2.3.0.Alpha
  • internal improvements and fixes

Home page:
http://www.habarisoft.com/habari_hornetq.html
“Getting Started” guide:
http://www.habarisoft.com/download/HabariHornetQGettingStarted.pdf
Feature matrix:
http://www.habarisoft.com/download/HabariFeatureMatrix.pdf
Online API documentation:
http://www.habarisoft.com/habari_hornetq/1.8/docs/api/index.html

Habari Client for Apollo 1.2

August 7, 2012 – Habarisoft is pleased to announce release 1.2 of Habari Client for Apollo. ActiveMQ Apollo is a faster, more reliable, easier to maintain messaging broker built from the foundations of the original ActiveMQ.
With this library, Delphi and Free Pascal developers can build integrated solutions, connecting applications using the peer-to-peer and the publish and subscribe communication model.
New in version 1.2

  • STOMP 1.1 support
  • NACK (negative ACK) support
  • tested with Apollo 1.4 (released August 6 2012)
  • internal improvements and fixes

Home page:
http://www.habarisoft.com/habari_apollo.html
“Getting Started” guide:
http://www.habarisoft.com/download/HabariApolloGettingStarted.pdf
Feature matrix:
http://www.habarisoft.com/download/HabariFeatureMatrix.pdf
Online API documentation:
http://www.habarisoft.com/habari_apollo/1.2/docs/api/index.html