Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A simple trace reading from a database:

...

Once a trace contains information from more than a single channel, a visualization option is shown. For example, if we branch a message to 10 other channels (the branch sample on the Connexion nuget server), we can navigate to a target channel and view both a tabular representation and a visual one:

...

In the above example, a message was received via mllp by the Branch channel. The message was then branched to 10 other channels (O1 through O10). When viewing a message in the O1 channel, we can see the message trace shows the incoming Uri, the receiving channel (Branch), our channel (O1) and finally the target mllp outbound system (127.0.0.1:12000). We can see that time the message queued within each channel and the total time it took from receiving the message to send to the final destination (1m 6s).

The copy icon in the Message Source Trace title bar can be used to copy and paste this information into a text editor or Excel.

Note the additional grey bar containing the hyperlink ‘Full Trace’. Use this hyperlink to create a visual representation for this message which includes all trace information available within the current Connexion System. This view will inspect this message within other channels so you can see other channels which also contain this message.

Info

Remember, message tracing only shows information upstream to the currently selected queue. To view a message trace that spans multiple Connexion systems, run the trace from the final Connexion instance.

Clicking the ‘Full Trace’ hyperlink produces the following interactive trace:

...

In this diagram, we can see the origin of the message (the network), the message passing through the Branch channel to each target channel (O1 through O10), and each of those channels sending the message over the network to a target. The diagram is interactive, allowing you to zoom and pan. The channel in orange is the currently selected channel within the Connexion UI.

Note the 'P' in the green circle overlayed on the queue icon. This signifies the message is in a processed state within that queue. Other queues may contain that message in a queued, errored, or other state, and the circle text and color changes to signify this.

The Message Trace UI has the following toolbar:

...

From left-to-right, these buttons are:

  1. Export diagram to image file.

  2. Pop out/in from the main Connexion window. This is useful when viewing large diagrams which require screen space.

  3. Diagram style (some of these are experimental and not particularly useful in most cases).

  4. Line style

  5. Zoom-to-fit

  6. Toggle the display of trace textual information underneath each channel (this is useful on large diagrams which require screen space).

  7. Close diagram (and return to the typical channel view).

Sample trace within a single Connexion system:

...

Accessing and Setting Trace Information

Trace information can be inspected and appended to in your custom devices (or the custom code device) and is accessible on the IMessageContext object.

Code Block
languagejava
// * Warning: Contrived example
using System;
using System.Threading;
using Connexion.Core;
using System.Threading.Tasks;

namespace Connexion.Device
{
  public partial class CustomDevice : BaseCustomDevice
  {	
	public override async Task ProcessMessageAsync(IMessageContext context, CancellationToken token)
    {
      // the trace information is exposed via the context.MessageExtension property
      foreach(var trace in context.MessageExtension.GetMessageTrace())
      {
        // the trace object has a Uri property and Utc property
        Console.WriteLine($"Uri: {trace.Uri}, Utc Stamp {trace.Utc}");
      }
      
      // add your own trace information
      if(Uri.TryCreate("cxn://mydevice/operation", UriKind.RelativeOrAbsolute, out var uri))
        context.MessageExtension.AddTrace(uri);
      
      // if you are sending to an external resource, use the following overload to signify
      // an outbound external endpoint
      if(Uri.TryCreate("myservice://ingestionPath/", UriKind.RelativeOrAbsolute, out var uriOutbound))
        context.MessageExtension.AddTrace(uriOutbound, TraceInfoFlag.Out);
    } 
  }
}