Samba file transfer in IIB v9 with Java custom nodes

We had to implement a Samba file transfer using IBM Integration Bus. Because my customer decided not to mount the shared Samba folder on the machines, we couldn’t use the default File Read and File Write nodes of IBM Integration Bus. Therefore I had to write custom nodes in Java, so they could be used and reused in multiple applications. The use of IBM’s MQFTE solution is maybe a future evolution.


Before going into further details of these nodes and its use, another thing has to be explained. There exists a dynamically created .properties file, which contains the following information about multiple Samba directories (each time for the source and destination):

  • Credentials (domain, user & password)
  • IP address
  • Directory location
  • Pattern of the requested filenames

A message flow reads this .properties file every 60 seconds. I’ve wrote some Java code in this message flow, which creates a command message for every directory listed in the .properties file. All of these command message are then sent separately to another message flow that contains the Samba poll node.

Custom Samba nodes in Java

I separated this Samba file transfer in 3 nodes:

  • Samba poll: receives a command from the trigger and polls that certain directory. For each file it finds, which satisfies the pattern, it sends a command with information about the source file and its source location and destination.
  • Samba file read: receives a command from the Samba poll node and actually reads the file and sends it binary in a command message with information about its destination.
  • Samba file write: at last the Samba file write node receives the last command, containing the file binary. It writes the file to its required destination.

These nodes are not all in the same message flow and WebSphere MQ is to put the command messages on queues in between the message flows. The poll node is always in a separated message flow so it can poll all the directories fast without having to wait for files to be read or written. This flow and the Trigger flow are both out of transaction, since their command messages will be resent after the next trigger in 60 seconds if a failure occurs and they don’t hold sensitive data.

The read and write node are only in the same message flow if the file transfer has to be done locally. If the file has to be written remotely to a different machine, it will be put on a remote queue first which will arrive at the destination machine using channels.

Overview with example

The following image provides the example of the complete operation of the nodes to give a better overview. In this example I pretended there are 2 different directories listed in the .properties file. The first directory and its files are shown in blue and the second in red. This will give you a better idea of multiple messages in multiple directories.

Samba operation flow

Author: Lowie Cuypers



Curious to know more about this topic?

Working at i8c

i8c is a system integrator that strives for an informal atmosphere between its employees, who have an average age of approx 30 years old. We invest a lot of effort in the professional development of each individual, through a direct connection between the consultants and the management (no multiple layers of middle management). We are based in Kontich, near Antwerp, but our customers are mainly located in the triangle Ghent-Antwerp-Brussels and belong to the top 500 companies in Belgium (Securex, Electrabel, UCB, etc…).

Quality Assurance

i8c is committed to delivering quality services and providing customer satisfaction. That’s why we invested in the introduction of a Quality Management System, which resulted in our ISO9001:2000 certification. This guarantees that we will meet your expectations, as a reliable, efficient and mature partner for your SOA & integration projects.

i8c - ISO9001-2015

Also worth reading

Apigee Scope Validation using OpenAPI Specification

In API security and management, we often use a lot of different security mechanisms to protect the requested resource behind the API Gateway. One of these mechanisms is the validation of scopes to authorize a client on a specific sub-resource of the API. Most of

Read More »

Integrating with TIBCO CLOUD

Our experts Glenn, Jason, Jurgen, and Kevin dedicated an i8c FastTrack Day to examining the TIBCO iPaaS offering. Check out their Research & Development day report to learn what they uncovered. 👇  TIBCO CLOUD™ The TIBCO Cloud™ Integration enterprise integration platform-as-a-service (iPaaS) provides self-service integration

Read More »