Axinom Encoding Service sends events to endpoints when a job's state changes. Learn how configure Azure Service Bus to be your message publisher.

Message Publishers with Azure

Axinom Encoding Service sends events to defined endpoints when a job’s state changes. Each such event contains useful information. It is up to your application to listen for these events and to define the handling behavior.

To start receiving events during job processing, you should specify target endpoints in the API request’s MessagePublishers section. Azure Service Bus is one option that you could use. Messages are published to Azure Service Bus Queues. You need to create a Azure Service Bus with a preferred name.

Creating a Service Bus

To create a service bus and get the connection string:

  1. On the Azure website, click the three bars in the top left corner to open the menu. From the menu, click Create a resource.

    azure create resource
    Figure 1. Start creating a resource
  2. On the next page, click Integration. A list of services appears to the right. From this list, find Service Bus and click Create.

    azure integration sb
    Figure 2. Click Create
  3. In the Create namespace page, provide your project and instance details. Note that you can name your queue whatever you like in the Namespace name field. However, it should be unique. Please also note that Azure will automatically change it to lowercase.

    1. If you wish, you can also apply tags in the next window.

    2. When ready updating the details, click the Review/create button. The details of your queue shall be displayed after validation.

    3. Click Create to complete the process.

  4. You are taken to the Overview page of your queue. Your queue shall be deployed.

  5. Once the deployment is done, click Go to Resource.

  6. Next, find the correct connection string for the Azure service bus queue you created. In the left-hand menu, under Settings, click Shared access policies. In the example below, it is called RootManageSharedAccessKey.

    azure shared access policies
    Figure 3. Find the policy from the list
  7. According to the policy you select, you can select the connection string. The keys and connection strings are displayed on the right. Copy the value by clicking the relevant icon on the row.

    azure connection string
    Figure 4. The primary and secondary key have been excluded from this example but you should see your values
  8. Use the key and endpoint to fill in the MessagePublishers section of the econding job. The snippet below is an example. Replace the service bus name and secret key with actual values.

    {
        "Type": "AzureServiceBusQueue",
        "Connection": "Endpoint=sb://<azure_service_bus_name>.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=<your_secret_key>"
    }
Note
We recommend you to use credentials protection with the CredentialsProtection property. For instance, in the connection string above, you need to use credentials protection for the Shared Access key.

Creating an Azure Service Bus Queue

For each message type, you need to create a new queue with the "queue" postfix in its name. For instance, for the message of the type "jobcreated", there will be a queue called the "jobcreatedqueue". In addition, a message has a custom property "OriginalMessageType", which reflects the message type, for example, "JobCreated".

To create a queue:

  1. On your service bus namespace Overview page, click Queue.

    azure create queue
    Figure 5. Create an Azure Service Bus Queue
  2. In the pop-up that appears on the right, name your queue and specify its properties. Click Create.

  3. You can find your queue from the list under Entities that you can access via the left-hand menu.

    azure queue list
    Figure 6. Queue list
  4. When you run your encoding job with the correct connection string is correct and you have queues with correct names, messages will appear inside the queues. To see the messages inside a queue, you need to select a queue.

    messages inside the queue azure
    Figure 7. Messages inside a queue.
  5. You can see the details of the message queue if you click the queue, then click Service Bus Explorer (preview), click Peek at the top (next to Send and Receive) and then click Peek again at the bottom.

    message details azure
    Figure 8. Message details.
  6. When you click the message, you can get the message body.

    message details json view azure
    Figure 9. Message body.

Further, you can copy the message and check message body using a Json formatter (e.g. https://jsonformatter.org/).

Tip
Alternatively, you can use Service Bus Explorer to manage your queues and see the details inside the queues.