Tutorial: Event-Based Processing in RSSBus Connect

Implement custom logic, send email notifications, use your existing batch files, and more by hooking into the events for your RSSBus Connect ports. This tutorial shows you how to trigger actions in events. As an example, you will execute a batch file after sending a file from the AS2 port.

Taking Control of Events

RSSBus Connect enables you to take advantage of events through simple scripts. On the Events tab, click Insert Snippet to insert a code snippet that performs the action you want. Actions available in RSSBus Connect include the following:

  • Executing batch files
  • Sending emails
  • Processing Excel spreadsheets
  • Processing XML files
  • File I/O
  • Database I/O

RSSBus Connect includes a scripting engine that makes it easy to template documents and automate manual processes. In scripts, you can invoke the built-in operations or trigger other ports.

RSBScript is the scripting language of RSSBus. You will find many familiar programming constructs in RSBScript, such as conditionals, loops, and flow control.

You will also find constructs from RSS feeds and XML. Attributes, items, and feeds provide the inputs and outputs to operations.

Triggering Batch Files from Events

The sysExecute operation is a powerful tool for executing programs and commands. To run a batch file when your event fires, click Insert Snippet -> Execute Batch File. The following code is inserted into the event script:

<!-- Execute Batch File -->
<rsb:set attr="Name"       value="C:\\temp\\myfile.bat" />
<rsb:set attr="Arguments"  value='"[FilePath]"' />
<rsb:call op="sysExecute" />

The script passes the following input parameters to the sysExecute operation:

  • Name: The name of the command or program to execute. In this example, the value is a string literal representing the path to the batch file.
  • Arguments: The command-line arguments for the command or program. In this example, the value is the evaluation of the FilePath input to the AfterSend event — the name of the file that was sent. Use square brackets around an attribute name to get the attribute value.

All of an event's inputs are listed in the rsb:info block near the top of the script. Inputs include useful information available at that point in the data flow.

Below is the rsb:info block for the AfterSend event:

<!-- NOTE: Do not edit rsb:info -->
<rsb:info title="After Send"     desc="This event is fired after sending a file.">
  <input name="PortId"           desc="The Id of the port that sent the file." />
  <input name="Direction"        desc="The direction of transaction." />
  <input name="Filename"         desc="The name of the file that was sent." />
  <input name="FilePath"         desc="The path of the file after sending." />
  <input name="IsSynchronous"    desc="The MDN delivery mode of the send message." />
  <input name="AS2MessageId"     desc="The AS2 Id of the send message containing the file." />
  <input name="MessageId"        desc="The Id of the send message containing the file." />
  <input name="ErrorMessage"     desc="If an error occurred, this will contain the error message." />
</rsb:info>

See the Scripting chapter in the RSSBus Connect help documentation for more information on processing event inputs, example scripts, and an RSBScript reference.



Ready to get started?

Learn more about RSSBus Connect or download the free single-port license:

Download Now