Versions Compared

Key

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

...

Info

Please note that many of these features are subject to change with feedback

Message identifiers are exposed programmatically via the context.MessageExtension property.

...

Code Block
languagec#
using System;
using System.Linq;
using System.Text;
using System.IO;
using System.Collections.Generic;
using System.Threading;
using Connexion.Core;
using Connexion.Core.HL7;
using System.Threading.Tasks;

namespace Connexion.Device
{
  public partial class CustomDevice : BaseCustomDevice
  {	
    public override async Task ProcessMessageAsync(IMessageContext context, CancellationToken token)
    {
      // add an identifier
      context.MessageExtension.AddIdentifier("key", "value");
      
      // add multiple identifiers
      context.MessageExtension.AddIdentifiers(new List<Identifier>() { new Identifier("key1", "value1"), new Identifier("key2", "value2") });
      
      // consume/check identifiers
      foreach(var identifierKvp in context.MessageExtension.Identifiers)
      {
        var key = identifierKvp.Key;  // the key of the identifier
        var identifier = identifierKvp.Value; // the identifier object associated with the above key
        var acceptedValues = identifier.Value;  // comma-delimited string of values
      }
    } 
  }
}