Use Access to Write to a Topic
2 min
You can use an Access Publish node to write to a topic through the local message broker by using flows. This guide uses the string message Hi to write to a topic.
Before you Begin
- Make sure you create an Access API account. See Create an API Account and Manage API Accounts for more information.
- Make sure you have created a flow to read from a topic. See Use Access to Read from a Topic for more information.
To write a topic using Access:
- In Litmus Edge, navigate to the Flows Manager and create a new flow. See Create a Flow to learn more.
- In Litmus Edge, navigate to System > Tokens.
- From the Edit topics dialog box, do the following:
- Enter test-topic in the Write Topics field, and click Add Write Topic. The topic name appears below the Topic Name field. Make sure that there are no spaces in the topic name.
- Enter the same topic name(test-topic) in the Read Topics field, and click Add Read Topic. The topic name appears below the Topic Name field. Make sure that there are no spaces in the topic name.
- Return to the Flows browser tab and double-click the Access Publish node. The Edit Access Publish node dialog box appears.
- Topic Name: Paste the topic name test-topic you added in the Access Topic Name field.
- Return to the System > Tokens browser tab and do the following:
- Click the Action menu for the API account you created previously and select View API Key.
- Return to the Edit Access Connect node dialog box in the Flows browser tab and do the following:
- API Key: Paste the API key you copied.
- Double-click the Inject node. The Edit inject node dialog box appears.
- msg.payload: Select the String option from the drop-down list and enter Hi message in the Payload field.
- msg.topic: Enter the name of the write topic (test-topic) you added in the Access Write Topic field.
- Repeat: Select interval from the drop-down list.
- every: Enter a value for how often to add a message.
- Double-click the Access Subscribe node. The Edit access-subscribe node dialog box appears.
- Topic Name: Enter the name of the write topic you added in the Access Write Topic field.
- Access: From the drop-down list, select the Access Connect you defined in the Access-Publish node.
- Click Deploy.











