<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Himanshu Gupta</title>
    <description>The latest articles on DEV Community by Himanshu Gupta (@himanshugupta).</description>
    <link>https://dev.to/himanshugupta</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F315041%2F23d6c931-b9a2-4417-bc9f-d3b757952a57.jpeg</url>
      <title>DEV Community: Himanshu Gupta</title>
      <link>https://dev.to/himanshugupta</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/himanshugupta"/>
    <language>en</language>
    <item>
      <title>Solace PubSub+ vs Kafka: Implementation of the Publish-Subscribe Messaging Pattern</title>
      <dc:creator>Himanshu Gupta</dc:creator>
      <pubDate>Tue, 08 Jun 2021 19:09:06 +0000</pubDate>
      <link>https://dev.to/solacedevs/solace-pubsub-vs-kafka-implementation-of-the-publish-subscribe-messaging-pattern-46jg</link>
      <guid>https://dev.to/solacedevs/solace-pubsub-vs-kafka-implementation-of-the-publish-subscribe-messaging-pattern-46jg</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3yZdYs7B--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/06/blog-images-kafka-pubsub.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3yZdYs7B--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/06/blog-images-kafka-pubsub.jpg" alt=""&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;This blog post is the second part of a series comparing Apache Kafka with Solace’s &lt;a href="https://solace.com/products/event-broker/"&gt;PubSub+ Event Broker&lt;/a&gt;. In the first, my colleague Ush introduced the &lt;a href="https://dev.to/ushnash/solace-pubsub-vs-kafka-the-basics-jm6-temp-slug-4950833"&gt;two very different internal architectures that Kafka and Solace PubSub+ have&lt;/a&gt;. In this post, I’ll explain how pub/sub messaging pattern implementation differs in these two brokers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/blog/publish-subscribe-messaging-pattern/"&gt;Publish/Subscribe&lt;/a&gt;, commonly known as pub/sub, is a popular messaging pattern which is commonly used in today’s systems to help them efficiently distribute data and scale among other things. The pub/sub messaging pattern can be easily implemented through an event broker such as Solace PubSub+, Kafka, RabbitMQ, and ActiveMQ.&lt;/p&gt;

&lt;p&gt;When you use an event broker, you have a set of applications known as producers and another set of applications known as consumers. Producers are responsible for publishing data to the broker and similarly, consumers are responsible for consuming data from the event broker. By introducing a broker to our architecture, we have removed the need for producers to directly communicate with the consumers. This ensures we have a loosely coupled architecture. Additionally, our broker now becomes responsible for managing connections, security, and subscription interests, instead of implementing this logic in the applications themselves.&lt;/p&gt;

&lt;p&gt;Different event brokers implement the pub/sub messaging pattern differently. It is important to understand their implementations when deciding which event broker to use for your specific use case.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pub/Sub in Kafka
&lt;/h2&gt;

&lt;p&gt;To understand Kafka’s implementation of pub/sub, you need to understand topics, producers, and consumers.&lt;br&gt;&lt;br&gt;
 &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BA_uGDvG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/06/pubsub-vs-kafka_pic-01-1024x575.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BA_uGDvG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/06/pubsub-vs-kafka_pic-01-1024x575.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Topics
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://dev.to/ushnash/solace-pubsub-vs-kafka-the-basics-jm6-temp-slug-4950833"&gt;As described in part one&lt;/a&gt;, in Kafka messages are produced and consumed via topics. They are immutable log files, persisted on disk, to which data is appended sequentially. Given that Kafka is a distributed system, you need to create topics and decide how you want to partition and replicate them across your brokers. While topics can be created by default if they don’t exist, it is best practice to manually create them with appropriate settings before using them.&lt;/p&gt;

&lt;h3&gt;
  
  
  Producer
&lt;/h3&gt;

&lt;p&gt;A Kafka producer can be programmed to write data to a topic. If the topic has 3 partitions, data will be written to all 3 partitions in a round-robin fashion. This leads to a significant problem. Because our data is scattered across multiple partitions, we don’t get ordering across partitions. Additionally, Kafka publisher applications batch writes to improve performance as they publish data to Kafka brokers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Consumer
&lt;/h3&gt;

&lt;p&gt;If we want to consume the data we just wrote to our topic, we will need to create a consumer application and connect to our Kafka cluster. Your Kafka consumer can easily subscribe to a topic and consume the necessary data. However, as mentioned earlier, there is an issue caused by topic partitions. Because our data was written to 3 partitions, we have lost message ordering. When our consumer subscribes to the topic and consumes the data, it will get unordered messages. Depending on your system, this can be a critical issue.&lt;/p&gt;

&lt;p&gt;To overcome this issue, you will need to use a key when publishing data so that all the messages pertaining to a specific key will always go to the same partition and hence preserve ordering. However, as you may have guessed already, with this workaround, you lose simple the ability to have balanced parallelization resulting in some partitions overflowing while others will be lightly used.&lt;/p&gt;

&lt;p&gt;Furthermore, in Kafka, messages are polled instead of pushed to the consumer. When you program your consumer application, you are expected to provide a timer to constantly poll for data. As you can imagine, this can be highly inefficient if your application is frequently polling for data, especially when there is no data available.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pub/Sub in Solace PubSub+
&lt;/h2&gt;

&lt;p&gt;Solace’s PubSub+ Event Broker is an enterprise-grade event broker which supports open APIs and protocols. It comes with numerous enterprise-grade&lt;u&gt; &lt;/u&gt;features straight out-of-box such as high-availability, disaster recovery, and security so enterprises don’t have to implement them.&lt;br&gt;&lt;br&gt;
 &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rznHSf0x--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/06/pubsub-vs-kafka_pic-02-1024x516.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rznHSf0x--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/06/pubsub-vs-kafka_pic-02-1024x516.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Topics
&lt;/h3&gt;

&lt;p&gt;As you can see in the previous part, the topics of PubSub+ are very different from those of Kafka. Unlike Kafka’s topics, PubSub+ topics are dynamic and don’t need to be manually created. They are simply metadata that you use to describe your messages as you publish them. Additionally, PubSub+ topics are hierarchical, which means consumers can use wildcards to filter based on different levels in a topic.&lt;/p&gt;

&lt;p&gt;PubSub+ topics don’t need to be partitioned or replicated. The fact that they don’t need to be created and persisted to disk means that they barely require any maintenance. As your system scales, there is no need to rebalance your topics as you do in Kafka.&lt;/p&gt;

&lt;h3&gt;
  
  
  Publisher
&lt;/h3&gt;

&lt;p&gt;PubSub+ publishers can be coded using any of the supported open APIs and protocols such as JMS, MQTT, AMQP, and REST. To publish data, your publisher application just needs to specify which topic to publish the data to. And that’s it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Subscriber
&lt;/h3&gt;

&lt;p&gt;Similar to Kafka, PubSub+ subscribers can be coded to consume from a topic by specifying the entire topic. Or you can subscribe to multiple topics using wildcards (* and &amp;gt;). Moreover, you can use these wildcards to dynamically filter data.&lt;/p&gt;

&lt;p&gt;For example, if your publisher is publishing data for all US stocks from different exchanges to topics such as &lt;code&gt;EQ/US/NYSE/AAPL&lt;/code&gt; and &lt;code&gt;EQ/US/NASDAQ/FB&lt;/code&gt;, my consumer can subscribe to different datasets by subscribing to any of the following topics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;EQ/&amp;gt;&lt;/code&gt; – for all equities stocks&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;*/*/NYSE/&amp;gt;&lt;/code&gt; – for all stocks traded on NYSE&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;*/*/*/FB&lt;/code&gt; – for all messages for Facebook traded on different exchanges&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It should be noted that with this approach PubSub+ Event Broker efficiently filters the datastreams to the clients as opposed to Kafka, where filtering happens on the client side or via an intermediary KStreams process. This saves both network bandwidth and compute resources on your consumer processes.&lt;/p&gt;

&lt;p&gt;Furthermore, PubSub+ subscribers are push based instead of poll based. Messages will be pushed to subscribers rather than constantly poll for data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;To sum it up, the pub/sub messaging pattern implementation exists in both Solace PubSub+ and Kafka but they differ significantly. While PubSub+ Event Broker utilizes dynamic, hierarchical topics with wildcard support, Kafka uses flat topics partitioned across different brokers. Additionally, Solace PubSub+ Event Broker supports open APIs and protocols which prevents vendor lock-in whereas while Kafka is open-source, it does not support open APIs and protocols natively.&lt;/p&gt;

&lt;p&gt;In the next post, we will discuss how filtering is achieved in both brokers.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://solace.com/blog/solace-pubsub-vs-kafka-comparison-publish-subscribe-messaging-pattern/"&gt;Solace PubSub+ vs Kafka: Implementation of the Publish-Subscribe Messaging Pattern&lt;/a&gt; appeared first on &lt;a href="https://solace.com"&gt;Solace&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>fordevelopers</category>
    </item>
    <item>
      <title>Demonstrating a Hybrid Architecture with RESTful and Streaming APIs</title>
      <dc:creator>Himanshu Gupta</dc:creator>
      <pubDate>Wed, 19 May 2021 13:00:53 +0000</pubDate>
      <link>https://dev.to/solacedevs/demonstrating-a-hybrid-architecture-with-restful-and-streaming-apis-5ba3</link>
      <guid>https://dev.to/solacedevs/demonstrating-a-hybrid-architecture-with-restful-and-streaming-apis-5ba3</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FzOly6TN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/05/solace-blog-featured-image_rest-eda-hybrid-gray.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FzOly6TN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/05/solace-blog-featured-image_rest-eda-hybrid-gray.jpg" alt=""&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;In my &lt;a href="https://dev.to/solacedevs/the-relevance-of-restful-apps-in-event-driven-architecture-1en1"&gt;last post&lt;/a&gt; I introduced the importance of event-driven architecture and endorsed a hybrid architecture consisting of both RESTful and streaming APIs. Now I’d like to walk you through a simple demo that shows the benefit of using a broker, such as Solace PubSub+ Event Broker, that can handle multiple &lt;a href="https://solace.com/products/apis-protocols/"&gt;open protocols and APIs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Besides allowing microservices to publish and consume events in real time, a major benefit of using an event broker is integration. A typical enterprise has all kinds of in-house and vendor products with different APIs and it can be extremely painful to get these applications to talk to each other.&lt;/p&gt;

&lt;p&gt;A &lt;a href="https://solace.com/what-is-an-event-broker/"&gt;modern event broker&lt;/a&gt; must support multiple open APIs and protocols without having to install new plug-ins or manage proxies. For example, &lt;a href="https://solace.com/products/event-broker/"&gt;PubSub+ Event Broker&lt;/a&gt; supports open protocols like AMQP, MQTT, REST, WebSocket, and APIs in multiple languages, which means you can have one application publishing data via REST and downstream applications consuming that data via AMQP and/or WebSocket. And if tomorrow, you onboard a new vendor application that supports MQTT only then you can easily use MQTT to stream data to the event broker.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hybrid Architecture
&lt;/h2&gt;

&lt;p&gt;In the previous post, I explained our hybrid architecture in which data is published to the event broker via REST and the broker is responsible for translating that event to the protocol desired by the downstream services.&lt;/p&gt;

&lt;p&gt;This demo consists of the following components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Solace PubSub+ Event Broker&lt;/li&gt;
&lt;li&gt;Publishers

&lt;ol&gt;
&lt;li&gt;REST publisher; simple REST POST command(s) via cURL&lt;/li&gt;
&lt;li&gt;Java publisher; using streaming API&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;Consumers

&lt;ol&gt;
&lt;li&gt;REST WebHooks; an endpoint will be invoked every time a message is received/enqueued.&lt;/li&gt;
&lt;li&gt;Java consumer; using MQTT protocol&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is what it will look like:&lt;br&gt;&lt;br&gt;
 &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TrQis1JR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/05/benefits-hybrid-restful-eda_01.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TrQis1JR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/05/benefits-hybrid-restful-eda_01.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see in the diagram, there are some objects created in the event broker as well. There are two types of delivery modes supported by PubSub+: direct and guaranteed. In direct messaging, there is no persistence. It is popularly used for high-throughput and low latency use cases where you can afford some data loss. For critical data, where you want zero message loss, you need guaranteed messaging.&lt;/p&gt;

&lt;p&gt;In this example, you’ll use guaranteed messaging and apply persistence via a queue. Our two publishers will publish messages to a well-defined topic with multiple levels (i.e., &lt;code&gt;prices/java/stocks/{ticker}&lt;/code&gt;). This allows our subscribers to consume the messages via topic subscriptions mapped to queues. For example, thre’s a queue called &lt;code&gt;queue_java_consumer&lt;/code&gt; for java consumer and added a topic subscription &lt;code&gt;prices/&amp;gt;&lt;/code&gt;. This will allow messages published by both REST and Java publishers to be enqueued in this queue.&lt;/p&gt;

&lt;p&gt;Similarly, there’s a separate queue for our REST consumer called &lt;code&gt;queue_rest_consumer&lt;/code&gt; with a different topic subscription &lt;code&gt;prices/rest/&amp;gt;&lt;/code&gt;. This means only messages published by the REST publisher will be enqueued in this queue.&lt;/p&gt;
&lt;h2&gt;
  
  
  Queues
&lt;/h2&gt;

&lt;p&gt;Before you start setting up our publishers and consumers, let’s create the queues that will hold the messages based on topic subscriptions mapped to them. Create two queues:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;queue_java_consumer&lt;/code&gt; with topic &lt;code&gt;prices/&amp;gt;&lt;/code&gt; mapped to it&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;queue_rest_consumer&lt;/code&gt; with topic &lt;code&gt;prices/rest/&lt;/code&gt; mapped to it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can create a queue by going to the &lt;strong&gt;Queues&lt;/strong&gt;  tab on PubSub+ Manager and clicking on  &lt;strong&gt;+ Queue&lt;/strong&gt;. Once the queue has been created, click on it and add the appropriate subscription.&lt;br&gt;&lt;br&gt;
 &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NTzj73Je--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/05/benefits-hybrid-restful-eda_02.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NTzj73Je--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/05/benefits-hybrid-restful-eda_02.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Publishers
&lt;/h2&gt;
&lt;h3&gt;
  
  
  REST publisher
&lt;/h3&gt;

&lt;p&gt;You can publish messages to the broker via cURL commands by executing a POST command against a URL which will contain the host and port of the broker and REST service running on the broker. It will also contain the topic address you want to publish the message to. For example, to publish a message to a local broker running to the topic &lt;code&gt;prices/rest/stocks/aapl&lt;/code&gt;, run this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
curl -X POST http://127.0.0.1:9000/prices/rest/stocks/aapl --header "Content-Type: application/json" -d '{"name":"aapl", "price":"130"}'

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The URL that’s used contains the host, port, and topic address in this syntax: &lt;code&gt;http(s)://:/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You can find more information about REST publishers &lt;a href="https://docs.solace.com/RESTMessagingPrtl/Solace-REST-Example.htm"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Java publisher
&lt;/h3&gt;

&lt;p&gt;Depending on the protocol you want to use (SMF, MQTT, AMQP), you can use the corresponding API. Solace has a command-line utility tool for demos and tests, called &lt;em&gt;sdkperf&lt;/em&gt;, freely available for download &lt;a href="https://solace.com/downloads/?fwp_downloads_types=other"&gt;here&lt;/a&gt;. It comes in different flavors based on the protocol you want to use. This demo uses &lt;em&gt;sdkperf-jcsmp&lt;/em&gt; that uses Solace’s SMF protocol. Here is a &lt;a href="https://docs.solace.com/SDKPerf/SDKPerf.htm"&gt;guide&lt;/a&gt; on how to use &lt;em&gt;sdkperf&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Here is the command that starts the Java publisher which will connect to the local broker and publish 10,000 messages at the rate of 1 message per second to the topic &lt;code&gt;prices/java/stocks/aapl&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; bash sdkperf_java.sh -ptl="prices/java/stocks/aapl" -mt=persistent -mn=10000 -mr=1 -msa=100 -cip=localhost:55555
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Consumers
&lt;/h2&gt;

&lt;h3&gt;
  
  
  REST consumer
&lt;/h3&gt;

&lt;p&gt;The REST consumer will be a webservice endpoint which is invoked every time the queue receives a message. You will first need to have a webservice which accepts POST commands.&lt;/p&gt;

&lt;h3&gt;
  
  
  Webservice
&lt;/h3&gt;

&lt;p&gt;Let’s spin up a webservice which will expose a REST endpoint. This endpoint will just echo the arguments once invoked. Here is sample python code to spin up the webservice:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
from flask import Flask, json, request
from flask import *

companies = [{"name": "ibm", "price": 134}, {"name": "msft", "price": 255}]

api = Flask( __name__ )

@api.route('/', methods=['GET'])
def get_companies():
  return json.dumps(companies)

@api.route('/', methods=['POST'])
def post_companies():
  name = request.args.get("name")
  price = request.args.get("price")
  print(json.dumps(request.json))
  return json.dumps(request.json), 201

if __name__ == ' __main__':
    api.run(host='0.0.0.0')

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I ran the script on an EC2 instance and issued a GET request against post 5000 and here is the output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
[{"name": "ibm", "price": 134}, {"name": "msft", "price": 255}]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means the webservice is working, so you can issue a POST command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
$ curl -X POST -H "Content-Type: application/json" -d '{"name":"nvda","price":"609"}' http://ec2-34-201-735.compute-1.amazonaws.com:5000

{"name": "nvda", "price": "609"}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So the POST command works as well.&lt;/p&gt;

&lt;h3&gt;
  
  
  REST consumer, queue binding, and RDP
&lt;/h3&gt;

&lt;p&gt;As you can tell from the architecture diagram shown earlier, there is something different about the REST consumer. That’s because you need to create some additional objects on the broker to set it up. These objects are &lt;code&gt;REST consumer&lt;/code&gt;, &lt;code&gt;queue binding&lt;/code&gt;, and &lt;code&gt;REST delivery point(RDP)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A REST consumer with Solace is not just a microservice that polls the broker with &lt;code&gt;GET&lt;/code&gt; commands. That wouldn’t be appropriate given that Solace PubSub+ is all about event-driven architecture. Instead, PubSub+ utilizes REST WebHooks via &lt;code&gt;POST&lt;/code&gt; commands so that the updates are pushed in real-time.&lt;/p&gt;

&lt;p&gt;When the publisher publishes a message to a topic, depending on the topic subscriptions mapped to queues, they will be routed to the appropriate queues. For a REST endpoint to be invoked, you need to create a REST delivery endpoint (RDP) on the broker. The RDP will consist of a REST consumer which will contain information about the HTTP endpoint to invoke among other things and a queue binding which will bind a queue to the consumer. This queue binding will ensure that when a message is enqueued in the queue, the broker will invoke the endpoint with the correct method (&lt;code&gt;POST&lt;/code&gt; or &lt;code&gt;PUT&lt;/code&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating an RDP
&lt;/h3&gt;

&lt;p&gt;To create a REST delivery endpoint on the broker, go to the PubSub+ Manager, click on the message VPN (i.e., &lt;em&gt;default&lt;/em&gt;) and click on the Client Connections tab. On the following page, click on REST and then, click on + Rest Delivery Point.&lt;/p&gt;

&lt;p&gt;Give your RDP a name, enable it, and click on  &lt;strong&gt;apply&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
 &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--n0fmtMMJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/05/benefits-hybrid-restful-eda_03.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--n0fmtMMJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/05/benefits-hybrid-restful-eda_03.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Creating a REST consumer
&lt;/h3&gt;

&lt;p&gt;Click on the RDP and then the REST Consumers tab. Then, click on + REST Consumer and give it a name. On the following page, enable the consumer and add host/port of the endpoint you wish to invoke when a message is received. In this case, that would be &lt;code&gt;http://ec2-34-201-77-35.compute-1.amazonaws.com:5000/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Select the appropriate method to invoke, which in this case is &lt;code&gt;POST&lt;/code&gt;. There are a lot of other settings you can configure but for now, leave them as default.&lt;br&gt;&lt;br&gt;
 &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AYHkel2q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/05/benefits-hybrid-restful-eda_04.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AYHkel2q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/05/benefits-hybrid-restful-eda_04.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Creating a queue binding
&lt;/h3&gt;

&lt;p&gt;Go to Client Connections &amp;gt; Queue Bindings and click on + Queue Binding. Select the &lt;code&gt;queue_rest_consumer&lt;/code&gt; queue and click on Create.&lt;br&gt;&lt;br&gt;
 &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wNc91V1a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/05/benefits-hybrid-restful-eda_05.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wNc91V1a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/05/benefits-hybrid-restful-eda_05.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since the specific endpoint is &lt;code&gt;/&lt;/code&gt;, set &lt;code&gt;Post Request Target&lt;/code&gt; to that.&lt;/p&gt;

&lt;p&gt;With all the necessary objects created on the broker, you are ready to publish your first message via REST.&lt;/p&gt;
&lt;h2&gt;
  
  
  Java Consumer
&lt;/h2&gt;

&lt;p&gt;You will be using &lt;code&gt;sdkperf-jcsmp&lt;/code&gt; to spin up a Java consumer quickly via this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&amp;gt; bash sdkperf_java.sh -cip=localhost:55555 -sql=queue_java_consumer -md -pe

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It will connect to the broker and bind to the &lt;code&gt;queue_java_consumer&lt;/code&gt; queue you created earlier.&lt;/p&gt;

&lt;h2&gt;
  
  
  Running the Demo
&lt;/h2&gt;

&lt;p&gt;Phew, everything is set and you’re ready to run the demo. Best practice is to run the consumers first. Your REST consumer is already running, so run the Java consumer with the command shown above.&lt;/p&gt;

&lt;p&gt;Then, start the Java publisher which will start publishing to topic &lt;code&gt;prices/java/stocks/aapl&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;As soon as you run the Java publisher, you will notice that your Java consumer will start picking up the messages.&lt;br&gt;&lt;br&gt;
 &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lTvUBoio--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/05/benefits-hybrid-restful-eda_06.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lTvUBoio--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/05/benefits-hybrid-restful-eda_06.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You should also see that the messages are making it to your queue &lt;code&gt;queue_java_consumer&lt;/code&gt;.&lt;br&gt;&lt;br&gt;
 &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7jQLxHGE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/05/benefits-hybrid-restful-eda_07.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7jQLxHGE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/05/benefits-hybrid-restful-eda_07.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, publish a message via REST using cURL.&lt;br&gt;&lt;br&gt;
 &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---09fONq7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/05/benefits-hybrid-restful-eda_08.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---09fONq7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/05/benefits-hybrid-restful-eda_08.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, you immediately see the output on the webservice logs. This means that the message was published to the broker on the topic &lt;code&gt;prices/rest/stocks/aapl&lt;/code&gt; and was enqueued in the queue &lt;code&gt;queue_rest_consumer&lt;/code&gt;. As soon as the message was enqueued, the configured endpoint was invoked which resulted in the webservice logging that output.&lt;/p&gt;

&lt;p&gt;Now, to make things interesting, you can change the topic that the Java publisher is publishing to so that those messages make it to the webservice as well. However, because you’re not setting a JSON payload for your &lt;em&gt;sdkperf&lt;/em&gt; Java publisher, the logged output might not be pretty. Let’s see what happens!&lt;/p&gt;

&lt;p&gt;I will use the same Java publisher but change the topic to &lt;code&gt;prices/rest/stocks/aapl&lt;/code&gt;.&lt;br&gt;&lt;br&gt;
 &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PoWJErYX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/05/benefits-hybrid-restful-eda_09.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PoWJErYX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/05/benefits-hybrid-restful-eda_09.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see in the above screenshot, my messages published by Java publisher are not only making it to the Java consumer (as before) but also to the webservice!&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap-up
&lt;/h2&gt;

&lt;p&gt;As you saw in the demo above, the system consisted of 2 publishers and 2 consumers. They were using REST and streaming APIs. You can get more creative as well and add publishers and consumers that use MQTT or AMQP.&lt;/p&gt;

&lt;p&gt;The beauty of using an event broker is that it allows you to decouple your microservices. You can easily modify your architecture tomorrow by adding new microservices or removing old ones and it would have no impact on downstream consumers as long as they get the messages they are interested in consuming.&lt;/p&gt;

&lt;p&gt;As you evolve your system from a batch-driven monolith to event-driven architecture consisting of microservices, remember that you might still need RESTful services (at least in the intermediate phase) which means you need to pick a broker that supports multiple protocols.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://solace.com/blog/demonstrating-hybrid-architecture-with-restful-and-streaming-apis/"&gt;Demonstrating a Hybrid Architecture with RESTful and Streaming APIs&lt;/a&gt; appeared first on &lt;a href="https://solace.com"&gt;Solace&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>forarchitects</category>
      <category>fordevelopers</category>
    </item>
    <item>
      <title>The Relevance of RESTful Apps in Event-Driven Architecture</title>
      <dc:creator>Himanshu Gupta</dc:creator>
      <pubDate>Thu, 29 Apr 2021 23:31:17 +0000</pubDate>
      <link>https://dev.to/solacedevs/the-relevance-of-restful-apps-in-event-driven-architecture-1en1</link>
      <guid>https://dev.to/solacedevs/the-relevance-of-restful-apps-in-event-driven-architecture-1en1</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2019%2F04%2FLIGHT_Replicating-the-Success-of-REST-in-Event-Driven-Architecture.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2019%2F04%2FLIGHT_Replicating-the-Success-of-REST-in-Event-Driven-Architecture.png"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;I love REST-based applications, especially when I am developing a new app and I need to get some data from another application. Learning from the team that their application has a REST API which is well documented and accessible via Swagger API is the best thing ever…besides having some sunny days after a freezing winter in NYC.&lt;/p&gt;

&lt;p&gt;You take a look at the Swagger page, figure out the REST endpoints you need to hit to get the data you need, and you’re good to go! But as you start to work on integrating these REST calls in your shiny new application, you need to build yet another integration. You realize you have done this a few times already before. You have worked on numerous existing and new applications that need to either share data with other apps or consume data from them.&lt;/p&gt;

&lt;p&gt;You’ve built such one-to-one integrations so many times that it’s a piece-of-cake by now, but it does take your valuable time and resources. You have to communicate with the other team, read the Swagger documentation, create JIRA tickets, have sprint meetings, test the API, implement failure logic (retries/time-outs) in case the endpoint is not available or is taking too long and, most annoyingly, poll for data at regular intervals.&lt;/p&gt;

&lt;p&gt;Wouldn’t it be nice to not go through so much trouble when adding new microservices? You might still need to create JIRA tickets and hold sprint meetings, but many of the other steps can be avoided.&lt;/p&gt;

&lt;p&gt;There are many use cases where REST is just the right way to build an application or microservice, but there is more and more demand for applications to become real-time. If your application is customer-facing, you know customers are demanding a more responsive, real-time service. You simply cannot afford to not process data in real-time anymore. Batch processing is just not sufficient in many modern use cases.&lt;/p&gt;

&lt;p&gt;RESTful services, inherently, must poll for data as opposed to being executed/triggered based on an event. RESTful services are akin to the kid on a road trip continuously asking “Are we there yet?” “Are we there yet?” “Are we there yet?”, and just when you thought the kid had gotten some sense and would stop bothering you, he asks again: “Are we there yet?”&lt;/p&gt;

&lt;p&gt;Additionally, RESTful services communicate _synchronously _as opposed to asynchronously. A synchronous call is blocking, which means your application cannot do anything but wait for the response. Alternatively, an asynchronous call is non-blocking providing your application with the freedom to continue processing. This can lead to much faster applications and improve customer experience.&lt;/p&gt;

&lt;p&gt;Of course, there are some calls that must be synchronous. For example, if your app is responsible for opening a bank account, you need to run security/background checks before approving the account. Other services, however, like the one responsible for updating customer’s address, don’t demand immediate action and acknowledgement.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Advantage of Being Real-Time&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Remember those pre-COVID days when we used to be able to fly? My favorite example is Delta’s mobile app — it’s one of the best apps of all the airlines I have flown. As soon as I am eligible for early check-in, I get a push notification with confirmation. As I pass through security, the app keeps me up to date about my plane’s status. If the gate gets changed at the last minute, I’m informed right away. Good thing, because it wouldn’t do me any good to know my gate changed from C-1 to B-10 thirty minutes after the fact if my flight’s door’s close in 20 minutes. If you check in your bag on the jetway because the flight is full, your app will confirm the scan, and when you land, you’ll get an alert letting you know which carrousel to pick up your bag from!&lt;/p&gt;

&lt;p&gt;The key here is not that the information is made available, but that it’s made available in real time as events occur. &lt;em&gt;That’s&lt;/em&gt; what makes a difference to the user experience, and I have picked Delta over other airlines simply due to their excellent mobile app and user experience.&lt;/p&gt;

&lt;p&gt;To be able to provide such an experience, applications need to implement event-driven architecture using event broker (such as &lt;a href="https://solace.com/products/event-broker/" rel="noopener noreferrer"&gt;Solace PubSub+&lt;/a&gt;) and streaming APIs.&lt;/p&gt;

&lt;p&gt;With such an architecture, your applications will publish data to your event broker in real time and your broker will be responsible for routing those events to any downstream subscriber(s). For example, as soon as I check in at the airport, an event can be published to a well-defined topic: &lt;code&gt;delta/customer/{customerID}/{airportID}/checkedIn&lt;/code&gt;. That’s all that specific application needs to do. It doesn’t need to worry about calling some REST endpoint, waiting for it to reply back, figuring out failure/retry logic, etc. And, in the future, if it needs to publish the same event to another app, it doesn’t need to worry about integrating with another REST endpoint. In fact, it doesn’t need to do anything. The downstream subscriber simply subscribes to the topic and gets the event.&lt;/p&gt;

&lt;p&gt;Once the event has been published, it is the router’s job to ensure it is delivered to all the downstream subscribers interested in this event. This is known as pub/sub messaging. Solace PubSub+ Event Broker supports guaranteed messaging which means zero message loss. If your subscribers are online, they can subscribe using wildcards such as &lt;code&gt;delta/customer/&amp;gt;&lt;/code&gt; or &lt;code&gt;delta/customer/*/JFK/&amp;gt;&lt;/code&gt; and the event(s) will be pushed to them. If one or more subscribers are not online for some reason, events will be enqueued in queues with ordering preserved. Whenever the subscriber comes online, it will simply consume those messages and pick up where it left off.&lt;/p&gt;

&lt;p&gt;These are just some of the benefits of &lt;a href="https://solace.com/blog/steps-to-implement-event-driven-architecture/" rel="noopener noreferrer"&gt;implementing event-driven architecture&lt;/a&gt;. There are plenty more such as scalability, agility, high-availability, and efficiency (via pub/sub). However, as with anything, make sure to do a deep dive, document all the requirements, and see if event-driven architecture makes sense for your use case.&lt;/p&gt;

&lt;h2&gt;
  
  
  Coexistence of REST APIs and Streaming APIs
&lt;/h2&gt;

&lt;p&gt;As I mentioned earlier, REST APIs are not going anywhere. There are many use cases that don’t need the additional complexity of an event broker and streaming APIs. For example, many user-facing applications should be REST-based as it is the standard for web-based applications. For example, if I am accessing a website, I am simply submitting a GET request. If I am entering some user information via a form, it’s a POST request. If I am scanning a QR code to submit a payment, it is just another RESTful endpoint behind the scenes. The user will submit a request over REST which most likely goes to some API gateway and is then routed to a broker. In this case, our publisher is REST-based. However, our downstream subscribers can choose to use REST, streaming APIs, or both!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2021%2F04%2Frestful-apps-in-eda.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2021%2F04%2Frestful-apps-in-eda.png" alt="Modern hybrid architecture with both REST and streaming APIs"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Modern hybrid architecture with both REST and streaming APIs&lt;/p&gt;

&lt;p&gt;This is another benefit of implementing event-driven architecture via Solace PubSub+ Event Broker. It supports a variety of APIs and open protocols which means your applications can choose which language (i.e., Java, Python, C, etc.) or protocol (i.e., MQTT, AMQP, SMF, etc.) to use.&lt;/p&gt;

&lt;p&gt;Thus, a modern architecture will most likely not be solely REST-based or event-driven but instead a combination of the two. As your architecture evolves from REST-based synchronous communication to real-time asynchronous communication, there will be some components of it that will continue being REST-based.&lt;/p&gt;

&lt;p&gt;To support such a hybrid architecture, you will need an event broker that supports REST out-of-box without any plugins or any proxy services. It will need to handle protocol translation from REST to other open protocols such as MQTT and AMQP reliably.&lt;/p&gt;

&lt;p&gt;If your use case does lend to full evolution from REST to streaming, then having a broker which supports REST protocol natively will make it much easier for you to migrate your services. You can select one service at a time to support streaming and others can continue using REST.&lt;/p&gt;

&lt;p&gt;In a subsequent post, I will demo a hybrid architecture such as the one shown above. All you need to know for now is that as you consider moving to an event-driven architecture, you don’t and shouldn’t necessarily get rid of all your RESTful services. Your evolved architecture might be a hybrid one!&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://solace.com/blog/restful-apps-in-event-driven-architecture/" rel="noopener noreferrer"&gt;The Relevance of RESTful Apps in Event-Driven Architecture&lt;/a&gt; appeared first on &lt;a href="https://solace.com" rel="noopener noreferrer"&gt;Solace&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>forarchitects</category>
      <category>fordevelopers</category>
    </item>
    <item>
      <title>Publishing Real-Time Tweets to Solace PubSub+ Event Broker</title>
      <dc:creator>Himanshu Gupta</dc:creator>
      <pubDate>Wed, 02 Dec 2020 16:17:49 +0000</pubDate>
      <link>https://dev.to/solacedevs/publishing-real-time-tweets-to-solace-pubsub-event-broker-292m</link>
      <guid>https://dev.to/solacedevs/publishing-real-time-tweets-to-solace-pubsub-event-broker-292m</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2019%2F07%2Fchat-app-blog-featured-image.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2019%2F07%2Fchat-app-blog-featured-image.jpg"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;If you want to work with real-time streaming data, the two most popular feeds you will come across are Wikipedia updates and Twitter tweets. While capturing Wikipedia updates used to be quite trendy a few years ago, recently, capturing tweets from Twitter and running sentiment analysis on this has become trendier.&lt;/p&gt;

&lt;p&gt;In this post, I would like to show you how you can write a Twitter publisher that will use Twitter’s API (under the hood) to get tweets as they are published in real-time and publish them to Solace PubSub+ Event Broker using JMS.&lt;/p&gt;

&lt;p&gt;You can find my code on &lt;a href="https://github.com/himoacs/solTweet" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Twitter/PubSub+ Connection Settings&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;My Twitter publisher is based on Hosebird Client (&lt;a href="https://github.com/twitter/hbc" rel="noopener noreferrer"&gt;github&lt;/a&gt;) by Twitter which is a Java HTTP client for consuming Twitter’s standard &lt;a href="https://developer.twitter.com/en/docs/tweets/filter-realtime/overview" rel="noopener noreferrer"&gt;Streaming API&lt;/a&gt;. The client is easy to use and if you follow the instructions/explanation on README.md, you will be able to understand how to set it up.&lt;/p&gt;

&lt;p&gt;To be able to access Twitter’s API, you will need to get a &lt;a href="https://developer.twitter.com/en/apply-for-access" rel="noopener noreferrer"&gt;Twitter developer account&lt;/a&gt; and register your app. Once you have been approved, you will have access to &lt;code&gt;consumerKey&lt;/code&gt;, &lt;code&gt;consumerSecret&lt;/code&gt;, &lt;code&gt;token&lt;/code&gt;, and &lt;code&gt;tokenSecret&lt;/code&gt;that you will need to populate in &lt;code&gt;resources/twitter.yaml&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;Similarly, you will need to populate your Solace PubSub+ connection information in &lt;code&gt;resources/broker.yaml&lt;/code&gt;. You will need &lt;code&gt;host&lt;/code&gt;, &lt;code&gt;vpn&lt;/code&gt;, &lt;code&gt;username&lt;/code&gt;, and &lt;code&gt;password&lt;/code&gt;. You can easily spin up a PubSub+ instance using &lt;a href="https://docs.solace.com/Solace-SW-Broker-Set-Up/Docker-Containers/Set-Up-Docker-Container-Image.htm" rel="noopener noreferrer"&gt;docker container&lt;/a&gt; or through &lt;a href="https://console.solace.cloud/login/new-account" rel="noopener noreferrer"&gt;PubSub+ Event Broker: Cloud&lt;/a&gt; (free tier account with 60-day free trial).&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Subscribing to Tweets&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The Twitter API allows you to subscribe to multiple keywords and get real-time tweets that contain those keywords. Since we are going through a pandemic right now, I have decided to pick covid-19 and coronavirus as my keywords. You can pick different keywords.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;List&amp;lt;String&amp;gt; terms = Lists.newArrayList("covid-19", "coronavirus"); hosebirdEndpoint.trackTerms(terms);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Publishing to PubSub+ Topic
&lt;/h2&gt;

&lt;p&gt;As soon as we connect, we will start receiving relevant tweets as JSON strings. We are interested in publishing these tweets to topics on Solace PubSub+ Event Broker. Since PubSub+ supports rich hierarchical topics and dynamic filtering using wildcards, we should put useful information on our topics which the consumers can use to filter the data.&lt;/p&gt;

&lt;p&gt;With this in mind, I will use “tweets/v1/covid/” + language of the tweet as my topic structure. Each tweet has a field called &lt;code&gt;lang&lt;/code&gt;which tells you the language of the tweet. For example, if the tweet is in English, value of &lt;code&gt;lang&lt;/code&gt;will be &lt;code&gt;en&lt;/code&gt;. So, for tweets that are in English, they will be published to topic: &lt;code&gt;tweets/v1/covid/en&lt;/code&gt;. If a tweet is in French, it will be published to: &lt;code&gt;tweets/v1/covid/fr&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if(msg!=null){     JSONObject jsonMsg = (JSONObject) parser.parse(msg);     String lang = (String) jsonMsg.get("lang");     publishMessageToSolace(session, msg, "tweets/v1/covid/" + lang);      // Control the msg publish rate     Thread.sleep(1000); }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why did I include language in the topic? I did so because later, I would like my consumers to have the flexibility to filter tweets based on language. For example, I might only want tweets that are in English. With Solace’s support for rich hierarchical topics, we can dynamically filter data using wildcards. My consumer can simply subscribe to &lt;code&gt;tweets/*/*/en&lt;/code&gt; and get only English tweets. If my consumer wanted tweets in all languages, it can subscribe to &lt;code&gt;tweets/&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That’s pretty much it. To get started with my code, you have to add your twitter and broker information in the respective config files, decide which keywords you want to get tweets for, and which topic you want to publish messages to.&lt;/p&gt;

&lt;h2&gt;
  
  
  Running the Code
&lt;/h2&gt;

&lt;p&gt;Once you start the publisher, you will notice the following output (via IntelliJ):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/10/pubsub-tweets-1.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2020%2F10%2Fpubsub-tweets-1.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, we are getting tweets in different languages: &lt;code&gt;en&lt;/code&gt;, &lt;code&gt;pt&lt;/code&gt;, &lt;code&gt;nl&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;However, our subscriber can decide which topic to subscribe to and here is an example of a subscriber (via Solace’s Try Me! app on the management UI) subscribing to just English tweets via &lt;code&gt;tweets/v1/covid/en&lt;/code&gt; topic.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/10/pubsub-tweets-2.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2020%2F10%2Fpubsub-tweets-2.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you have these tweets being distributed over Solace PubSub+ Event Broker, your applications can use any of the different &lt;a href="https://solace.com/downloads/" rel="noopener noreferrer"&gt;open APIs and protocols Solace supports&lt;/a&gt; to consume this data. For example, you can even create an &lt;a href="https://solace.com/what-is-an-event-mesh/" rel="noopener noreferrer"&gt;event mesh&lt;/a&gt; and stream this data to an ML application in AWS or GCP to perform sentiment analysis!&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://solace.com/blog/publishing-real-time-tweets-event-broker/" rel="noopener noreferrer"&gt;Publishing Real-Time Tweets to Solace PubSub+ Event Broker&lt;/a&gt; appeared first on &lt;a href="https://solace.com" rel="noopener noreferrer"&gt;Solace&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>twitter</category>
      <category>pubsub</category>
      <category>broker</category>
      <category>realtime</category>
    </item>
    <item>
      <title>Achieving Event-Driven Architecture with Solace PubSub+ Event Broker and MuleSoft</title>
      <dc:creator>Himanshu Gupta</dc:creator>
      <pubDate>Sat, 01 Aug 2020 16:28:41 +0000</pubDate>
      <link>https://dev.to/himanshugupta/achieving-event-driven-architecture-with-solace-pubsub-event-broker-and-mulesoft-2ao7</link>
      <guid>https://dev.to/himanshugupta/achieving-event-driven-architecture-with-solace-pubsub-event-broker-and-mulesoft-2ao7</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RIxwe-6b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/solace-blog-featured-image-mulesoft.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RIxwe-6b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/solace-blog-featured-image-mulesoft.jpg" alt="" width="880" height="419"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;One of the benefits of my current job is that I get to work with companies from different industries. As someone who had only worked in financial services before, it has been a very rewarding experience to understand the kinds of challenges companies face in other industries and how they compare to challenges commonly found in financial services. Additionally, I also get to learn about their technology stack.&lt;/p&gt;

&lt;p&gt;Recently, I had the opportunity to work with a popular iPaaS (integration platform as a service) solution called MuleSoft which was acquired by Salesforce. MuleSoft, like other integration solutions, makes it as easy as dragging and dropping connectors to connect your applications. Such tools are heavily used to integrate applications from different domains together. For example, you can link your CRM app to your marketing app, invoice app, and analytics app with a simple drag-and-drop.&lt;/p&gt;

&lt;p&gt;As you can probably guess, iPaaS tools are built on synchronous RESTful APIs. For your marketing app to be integrated with your CRM app, you need to have appropriate RESTful endpoints. While this works fine, we know that synchronous REST calls have their limitations when compared with the &lt;em&gt;asynchronous&lt;/em&gt; calls of event-driven architecture. Instead of polling for data, you would rather have your apps sharing messages via the publish/subscribe messaging that enables event-driven architecture as part of your Mulesoft environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What are the advantages of event-driven architecture and&lt;/strong&gt; publish/subscribe &lt;strong&gt;messaging?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;You have undoubtedly heard of these terms before because, in the last few years, both have gotten extremely popular. Our world is full of events so your applications need to be event-driven. When a credit card is swiped, an event is fired which triggers a bunch of other downstream events. For example, your phone gets a real-time notification informing you that your card was just swiped, your credit card balance is updated, and so forth.&lt;/p&gt;

&lt;p&gt;I have &lt;a href="http://abitdeployed.com/2019/12/30/what-is-event-driven-architecture-eda/"&gt;previously written a post&lt;/a&gt; about the nature and advantages of event-driven architecture, but here are the main ones:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Perform analytics and actions on real-time data as opposed to stale data obtained from batch processing&lt;/li&gt;
&lt;li&gt;Identify issues in real-time instead of waiting till the batch is executed&lt;/li&gt;
&lt;li&gt;Push vs pull – events are pushed to your applications as opposed to constantly polling for updates&lt;/li&gt;
&lt;li&gt;Loosely coupled applications&lt;/li&gt;
&lt;li&gt;Easier to scale&lt;/li&gt;
&lt;li&gt;Typical pub/sub benefits such as the efficient distribution of data, persistence, replay, and migration to the cloud&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Implementing Event-Driven Architecture with MuleSoft and Solace PubSub+
&lt;/h2&gt;

&lt;p&gt;Now that we have a better idea of why you should consider using pub/sub messaging with your iPaaS, let’s look at how to achieve Mulesoft event-driven architecture. We will use MuleSoft’s &lt;a href="https://www.mulesoft.com/lp/dl/studio"&gt;Anypoint Studio&lt;/a&gt; which you can download for free (there may be a 30-day limit).&lt;/p&gt;

&lt;p&gt;For our broker, we will be using &lt;a href="https://docs.solace.com/Solace-SW-Broker-Set-Up/Docker-Containers/Set-Up-Docker-Container-Image.htm"&gt;PubSub+ Event Broker deployed via Docker&lt;/a&gt; container on my laptop, but you can also use &lt;a href="https://console.solace.cloud/login/new-account"&gt;PubSub+ Event Broker: Cloud&lt;/a&gt; which has a free tier. PubSub+ supports open APIs and protocols, so it’s really easy to use it with other products. For example, to integrate it with Mulesoft, we will be using Mulesoft’s JMS module.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use Case
&lt;/h3&gt;

&lt;p&gt;We have a CRM system such as Salesforce which pushes updates to a REST endpoint whenever there is an account update such as an account being created. The update contains high-level information about the account itself (name, website etc.), contact information, contract information, and location information (address). We have downstream applications such as marketing app, invoice app, and analytics app which are interested in one or more of these types of information contained in the entire account update.&lt;/p&gt;

&lt;p&gt;Here is what our downstream applications are interested in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Analytics app – interested in high-level account and contract information&lt;/li&gt;
&lt;li&gt;Invoice app – interested in contract information only&lt;/li&gt;
&lt;li&gt;Marketing app – interested in contact and location information&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Our goal is to digest the original payload (XML schema), parse it, and split it into 4 different smaller payloads:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;High-level account information&lt;/li&gt;
&lt;li&gt;Contact information&lt;/li&gt;
&lt;li&gt;Location information&lt;/li&gt;
&lt;li&gt;Contract information&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then, we need to publish this data on different topics and have different consumers subscribe to this data depending on their interest.&lt;/p&gt;

&lt;p&gt;Notice that despite having multiple apps subscribing to the same data (both &lt;em&gt;analytics&lt;/em&gt; and &lt;em&gt;invoice&lt;/em&gt; apps are interested in _contrac_t data), we only need to publish it once. This is one of the key benefits of using pub/sub messaging pattern. While it may not seem like a major benefit in our use case, it definitely makes a difference when you are dealing with high data volumes.&lt;/p&gt;

&lt;p&gt;Additionally, we are able to dynamically filter the dataset using &lt;a href="https://docs.solace.com/PubSub-Basics/Understanding-Topics.htm"&gt;PubSub+’s rich hierarchical topics&lt;/a&gt; instead of having all our applications consume the same data and then having to filter themselves.&lt;/p&gt;

&lt;h2&gt;
  
  
  Schemas and Topics
&lt;/h2&gt;

&lt;p&gt;One of the benefits of using an iPaaS such as MuleSoft is that it allows you to transform your data, which can come in very handy in event-driven architecture. In our case, we will be ingesting XML payload but the output will be in JSON.&lt;/p&gt;

&lt;p&gt;Here is the schema of the original payload (topic: &lt;code&gt;company/sales/salesforce/customerAccount/all/created/v1/{accountId}&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"&amp;gt; &amp;lt;xs:element name="AccountId" type="xs:string"/&amp;gt; &amp;lt;xs:element name="AccountName" type="xs:string"/&amp;gt; &amp;lt;xs:element name="AccountSource" type="xs:string"/&amp;gt; &amp;lt;xs:element name="AnnualRevenue" type="xs:int"/&amp;gt; &amp;lt;xs:element name="BillingCountryCode" type="xs:string"/&amp;gt; &amp;lt;xs:element name="BillingState" type="xs:string"/&amp;gt; &amp;lt;xs:element name="CreatedDate" type="xs:dateTime"/&amp;gt; &amp;lt;xs:element name="CurrencyIsoCode" type="xs:string"/&amp;gt; &amp;lt;xs:element name="IsActive" type="xs:string"/&amp;gt; &amp;lt;xs:element name="IsArchived" type="xs:string"/&amp;gt; &amp;lt;xs:element name="IsDeleted" type="xs:string"/&amp;gt; &amp;lt;xs:element name="LastModifiedById" type="xs:string"/&amp;gt; &amp;lt;xs:element name="LastModifiedDate" type="xs:dateTime"/&amp;gt; &amp;lt;xs:element name="LastReferencedDate" type="xs:dateTime"/&amp;gt; &amp;lt;xs:element name="LastViewedDate" type="xs:dateTime"/&amp;gt; &amp;lt;xs:element name="ContactName" type="xs:string"/&amp;gt; &amp;lt;xs:element name="ContactId" type="xs:int"/&amp;gt; &amp;lt;xs:element name="ContactEmail" type="xs:string"/&amp;gt; &amp;lt;xs:element name="Description" type="xs:string"/&amp;gt; &amp;lt;xs:element name="Industry" type="xs:string"/&amp;gt; &amp;lt;xs:element name="NumberOfEmployees" type="xs:short"/&amp;gt; &amp;lt;xs:element name="Type" type="xs:string"/&amp;gt; &amp;lt;xs:element name="BillingAddress" type="xs:string"/&amp;gt; &amp;lt;xs:element name="Website" type="xs:anyURI"/&amp;gt; &amp;lt;xs:element name="ProductCode" type="xs:int"/&amp;gt; &amp;lt;xs:element name="ContractNumber" type="xs:int"/&amp;gt; &amp;lt;xs:element name="ContractAddress" type="xs:string"/&amp;gt; &amp;lt;xs:element name="Sum\_Units\_Sold\_\_c" type="xs:float"/&amp;gt; &amp;lt;xs:element name="SystemModstamp" type="xs:dateTime"/&amp;gt;&amp;lt;/xs:schema&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here are the schemas for the 4 payloads after they have been parsed:&lt;/p&gt;

&lt;p&gt;High-level account (topic: &lt;code&gt;company/sales/salesforce/customerAccount/account/created/v1/{accountId}&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "Body": { "type": "object", "properties": { "AccountId": { "type": "string" }, "AccountName": { "type": "string" }, "Website": { "type": "string" } }, "required": ["AccountId", "AccountName", "Website"] } }, "required": ["Body"]}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Contact (topic: &lt;code&gt;company/sales/salesforce/customerAccount/contact/created/v1/{accountId}&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "Body": { "type": "object", "properties": { "ContactName": { "type": "string" }, "ContactId": { "type": "string" }, "ContactEmail": { "type": "string" } }, "required": ["ContactName" "ContactId", "ContactEmail"] } }, "required": ["Body"]}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;``&lt;/p&gt;

&lt;p&gt;Location (topic: &lt;code&gt;company/sales/salesforce/customerAccount/location/created/v1/{accountId}&lt;/code&gt;):&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`&lt;br&gt;
{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "Body": { "type": "object", "properties": { "BillingCountryCode": { "type": "string" }, "BillingState": { "type": "string" }, "BillingAddress": { "type": "string" } }, "required": ["BillingCountryCode", "BillingState", "BillingAddress",] } }, "required": ["Body"]}&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Contract (topic: &lt;code&gt;company/sales/salesforce/customerAccount/contract/created/v1/{accountId}&lt;/code&gt;):&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`&lt;br&gt;
{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "Body": { "type": "object", "properties": { "ContractNumber": { "type": "string" }, "ContractAddress": { "type": "string" } }, "required": ["ContractNumber", "ContractAddress"] } }, "required": ["Body"]}&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Phew, that’s a lot of information to keep track of. We need to know our downstream applications, which events they are interested in, and what the schemas will be for those events. If only there was a design tool which allowed us to do that!&lt;/p&gt;

&lt;h2&gt;
  
  
  How PubSub+ Event Portal Helps You Manage Event-Driven Architecture
&lt;/h2&gt;

&lt;p&gt;The “event gods” have heard your pleas and granted your wish! Solace recently launched new product called &lt;a href="https://solace.com/products/portal/"&gt;PubSub+ Event Portal&lt;/a&gt; that is, as we like to say, “the market’s first event management toolset to design, create, discover, catalog, share, visualize, secure and manage all the events in your enterprise”.&lt;/p&gt;

&lt;p&gt;I used it to design the flow of our steps in our Mulesoft event-driven architecture, and here is what it looks like:&lt;br&gt;&lt;br&gt;
 &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--z1NOHhTK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/pubsubplus-mulesoft_pic-01.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--z1NOHhTK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/pubsubplus-mulesoft_pic-01.png" alt="" width="880" height="711"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, the Salesforce app at the top publishes the original event containing raw payload, which is then parsed by MuleSoft, and published to PubSub+ for downstream applications to consume — event-driven architecture in action!&lt;/p&gt;

&lt;p&gt;We can also create specific events and associate schemas in the Event Portal. For example, as you can see from the image above, our MuleSoft app is publishing &lt;code&gt;accountContractUpdates&lt;/code&gt; event which is being subscribed to by &lt;code&gt;InvoicingSystem&lt;/code&gt; application. Expanding that event shows us who created it, which topic it is published to, what the associated schema is, and which applications are subscribing and publishing this event.&lt;br&gt;&lt;br&gt;
 &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oFny4T68--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/pubsubplus-mulesoft_pic-02.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oFny4T68--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/pubsubplus-mulesoft_pic-02.png" alt="" width="880" height="640"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Again, while they may not seem very impressive right now, imagine how useful Event Portal would be to an organization with hundreds of applications and thousands of events!&lt;/p&gt;

&lt;h2&gt;
  
  
  Implementing MuleSoft Event-Driven Architecture
&lt;/h2&gt;

&lt;p&gt;Now that we have our events documented, we can start implementing them.&lt;/p&gt;

&lt;p&gt;Here is what my Mule workspace looks like:&lt;br&gt;&lt;br&gt;
 &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qyl745fC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/pubsubplus-mulesoft_pic-03.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qyl745fC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/pubsubplus-mulesoft_pic-03.png" alt="" width="880" height="476"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It consists of two flows: &lt;code&gt;Publisher&lt;/code&gt; and &lt;code&gt;Consumer&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;Publisher&lt;/code&gt; flow has an &lt;code&gt;http listener&lt;/code&gt; which is listening to my endpoint &lt;code&gt;localhost:5001/solace&lt;/code&gt;. When I issue a &lt;code&gt;POST&lt;/code&gt; request against this endpoint, the listener will capture the payload and pass it to 4 different &lt;code&gt;JMS Publish&lt;/code&gt; modules for publishing 4 different events to 4 different topics.&lt;/p&gt;

&lt;p&gt;Here is the connection setting for JMS Publish module:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`&lt;br&gt;
&amp;lt;jms:config name="Solace" doc:name="JMS Config" doc:id="635cb4d0-a727-4723-8d5f-6da38b806745" &amp;gt;&amp;lt;jms:generic-connection username="mule" password="mule"&amp;gt;&amp;lt;jms:connection-factory &amp;gt;&amp;lt;jms:jndi-connection-factory connectionFactoryJndiName="/jms/cf/default"&amp;gt;&amp;lt;jms:custom-jndi-name-resolver &amp;gt;&amp;lt;jms:simple-jndi-name-resolver jndiInitialFactory="com.solacesystems.jndi.SolJNDIInitialContextFactory" jndiProviderUrl="tcp://mule:mule@localhost:55555"&amp;gt;&amp;lt;jms:jndi-provider-properties &amp;gt;&amp;lt;jms:jndi-provider-property key="Solace\_JMS\_VPN" value="default" /&amp;gt;&amp;lt;/jms:jndi-provider-properties&amp;gt;&amp;lt;/jms:simple-jndi-name-resolver&amp;gt;&amp;lt;/jms:custom-jndi-name-resolver&amp;gt;&amp;lt;/jms:jndi-connection-factory&amp;gt;&amp;lt;/jms:connection-factory&amp;gt;&amp;lt;/jms:generic-connection&amp;gt;&amp;lt;/jms:config&amp;gt;&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And here is the config xml for one of the &lt;code&gt;JMS Publish&lt;/code&gt; modules:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`&lt;br&gt;
&amp;lt;jms:publish doc:name="Publish Account to Solace" doc:id="1a24df7f-c33d-4ca1-a551-0d097d85bb65" config-ref="Solace" destination='#[output textns ns0 http://schemas.xmlsoap.org/soap/envelope/---"company/sales/salesforce/customerAccount/account/created/v1/" ++ payload.ns0#Envelope.ns0#Body.AccountId]' destinationType="TOPIC"&amp;gt;&amp;lt;jms:message &amp;gt;&amp;lt;jms:body &amp;gt;&amp;lt;![CDATA[#[output application/xmlns ns0 http://schemas.xmlsoap.org/soap/envelope/---{ns0#Envelope: {ns0#Body: {AccountName: payload.ns0#Envelope.ns0#Body.AccountName,Website: payload.ns0#Envelope.ns0#Body.Website}}}]]]&amp;gt;&amp;lt;/jms:body&amp;gt;&amp;lt;/jms:message&amp;gt;&amp;lt;/jms:publish&amp;gt;&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I have a second flow called &lt;code&gt;Consumer&lt;/code&gt; which has a simple &lt;code&gt;JMS Consume&lt;/code&gt; module listening to a queue followed by a &lt;code&gt;JMS ack&lt;/code&gt; module for acknowledging messages. Here is its configuration:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`&lt;br&gt;
&amp;lt;flow name="Consumer" doc:id="e705a269-7978-40c5-a0d2-7279567278ad" &amp;gt;&amp;lt;jms:listener doc:name="Listener" doc:id="2c76ddb5-07ff-41aa-9496-31897f19d378" config-ref="Solace" destination="mule" ackMode="MANUAL"&amp;gt;&amp;lt;jms:consumer-type &amp;gt;&amp;lt;jms:queue-consumer /&amp;gt;&amp;lt;/jms:consumer-type&amp;gt;&amp;lt;/jms:listener&amp;gt;&amp;lt;logger level="INFO" doc:name="Logger" doc:id="cb53890f-9bc7-4bad-8512-55586aa61e8d" /&amp;gt;&amp;lt;jms:ack doc:name="Ack" doc:id="c2b197a8-2fcb-4954-b748-071ffde36da5" ackId="#[%dw 2.0output application/java---attributes.ackId]"/&amp;gt;&amp;lt;/flow&amp;gt;You will need to create a queue for the consumer to bind to. In my case, I have created a queue called &amp;lt;code&amp;gt;mule&amp;lt;/code&amp;gt; using Solace’s UI and mapped a topic to it: &amp;lt;code&amp;gt;company/sales/salesforce/customerAccount/&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;img src="https://solace.com/wp-content/uploads/2020/07/pubsubplus-mulesoft\_pic-04.png" alt="" width="1024" height="316" class="alignnone size-full wp-image-41324" /&amp;gt;Notice that instead of specifying an exact topic, I have used Solace’s wildcard &amp;gt; to select any topic that falls under that hierarchy. In our case, subscribing to this topic will allow us to consume all of the four events.Now we are ready to test our setup. Using Postman, I have sent a POST request:&amp;lt;img src="https://solace.com/wp-content/uploads/2020/07/pubsubplus-mulesoft\_pic-05.png" alt="" width="1024" height="499" class="alignnone size-full wp-image-41323" /&amp;gt;And here is the output of my Mule flow:INFO 2020-05-21 13:02:55,528 [[MuleRuntime].uber.03: [solace].Consumer.CPU\_LITE @85a5ceb] [processor: Consumer/processors/0; event: ea2e4270-9b84-11ea-9fe8-a483e79ba806] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: org.mule.runtime.core.internal.message.DefaultMessageBuilder$MessageImplementation{ payload=&amp;lt;?xml version='1.0' encoding='UTF-8'?&amp;gt;&amp;lt;ns0:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/"&amp;gt; &amp;lt;ns0:Body&amp;gt; &amp;lt;AccountName&amp;gt;Solace&amp;lt;/AccountName&amp;gt; &amp;lt;Website&amp;gt;www.solace.com&amp;lt;/Website&amp;gt; &amp;lt;/ns0:Body&amp;gt;&amp;lt;/ns0:Envelope&amp;gt; mediaType=application/xml; charset=UTF-8 attributes=org.mule.extensions.jms.api.message.JmsAttributes@460bec31 attributesMediaType=application/java}INFO 2020-05-21 13:02:55,536 [[MuleRuntime].uber.03: [solace].Consumer.CPU\_LITE @85a5ceb] [processor: Consumer/processors/0; event: ea2e4270-9b84-11ea-9fe8-a483e79ba806] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: org.mule.runtime.core.internal.message.DefaultMessageBuilder$MessageImplementation{ payload={ "Envelope": { "Body": { "ContactName": "Himanshu", "ContactId": "2309402", "ContactEmail": "himanshu@solace.com" } }} mediaType=application/json; charset=UTF-8 attributes=org.mule.extensions.jms.api.message.JmsAttributes@395abcae attributesMediaType=application/java}INFO 2020-05-21 13:02:55,566 [[MuleRuntime].uber.03: [solace].Consumer.CPU\_LITE @85a5ceb] [processor: Consumer/processors/0; event: ea2e4270-9b84-11ea-9fe8-a483e79ba806] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: org.mule.runtime.core.internal.message.DefaultMessageBuilder$MessageImplementation{ payload={ "Envelope": { "Body": { "ContractNumber": "123456", "ContractAddress": "535 Legget Drive, 3rd Floor, Ottawa, Canada" } }} mediaType=application/json; charset=UTF-8 attributes=org.mule.extensions.jms.api.message.JmsAttributes@6a4910db attributesMediaType=application/java}INFO 2020-05-21 13:02:55,574 [[MuleRuntime].uber.03: [solace].Consumer.CPU\_LITE @85a5ceb] [processor: Consumer/processors/0; event: ea2e4270-9b84-11ea-9fe8-a483e79ba806] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: org.mule.runtime.core.internal.message.DefaultMessageBuilder$MessageImplementation{ payload={ "Envelope": { "Body": { "BillingCountryCode": "US", "BillingState": "NY", "BillingAddress": "535 Legget Drive, 3rd Floor, Ottawa, Canada" } }} mediaType=application/json; charset=UTF-8 attributes=org.mule.extensions.jms.api.message.JmsAttributes@130e6e64 attributesMediaType=application/java}&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;As you can see, our single consumer in our &lt;code&gt;Consumer&lt;/code&gt; Mule flow was able to consume all the messages from our queue (&lt;code&gt;mule&lt;/code&gt;) which was subscribing to just one topic.&lt;/p&gt;

&lt;p&gt;Of course, to fully leverage the power of pub/sub messaging, event-driven architecture and Mulesoft, you can show having multiple consumers using Solace’s rich hierarchal topics to consume select events.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get on the road to event-driven architecture!
&lt;/h2&gt;

&lt;p&gt;That’s it for this post! I wanted to show you how you can make iPaaS tools such as MuleSoft even more powerful by adding pub/sub messaging to enable event-driven architecture. With Solace PubSub+, you can easily use JMS standard to connect to it and publish/consume messages.&lt;/p&gt;

&lt;p&gt;If you work with an iPaaS, I highly recommend considering PubSub+ to make your applications event-driven. &lt;a href="https://solace.com/products/event-broker/"&gt;PubSub+ Standard Edition&lt;/a&gt; is free to use, even in production!&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://solace.com/blog/mulesoft-event-driven-architecture-with-solace-event-broker/"&gt;Achieving Event-Driven Architecture with Solace PubSub+ Event Broker and MuleSoft&lt;/a&gt; appeared first on &lt;a href="https://solace.com"&gt;Solace&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>mulesoft</category>
      <category>eventdriven</category>
      <category>eventdrivenarchitecture</category>
      <category>pubsub</category>
    </item>
    <item>
      <title>Integrating PubSub+ Event Broker: Cloud with Lambda via API Gateway</title>
      <dc:creator>Himanshu Gupta</dc:creator>
      <pubDate>Tue, 07 Jul 2020 13:27:22 +0000</pubDate>
      <link>https://dev.to/himanshugupta/integrating-pubsub-event-broker-cloud-with-lambda-via-api-gateway-2lnm</link>
      <guid>https://dev.to/himanshugupta/integrating-pubsub-event-broker-cloud-with-lambda-via-api-gateway-2lnm</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5oDHnOP3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/solace-blog-featured-image-aws-lambda.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5oDHnOP3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/solace-blog-featured-image-aws-lambda.jpg" alt=""&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Serverless architecture is all the rage these days and nothing screams serverless like AWS Lambda. AWS Lambda is a serverless compute service that runs your code in response to events and automatically manages the underlying compute resources for you. When Lambda was announced a few years ago by AWS, it caused quite a bit of confusion but slowly it has gained popularity and become analogous to serverless architecture.&lt;/p&gt;

&lt;p&gt;Lambdas, which is what most people call the services you spin up with Lambda, are powerful because they can be easily triggered and scaled without having to worry about the underlying infrastructure.&lt;/p&gt;

&lt;p&gt;In this post, I would like to show you how you can send a message to a &lt;a href="https://solace.com/products/event-broker/"&gt;PubSub+ Event Broker&lt;/a&gt; running as a managed service on &lt;a href="https://solace.com/products/event-broker/cloud/"&gt;PubSub+ Event Broker: Cloud&lt;/a&gt; and use it to trigger a lambda through AWS’s API Gateway. And all of this without any code, except for the code you need for your Lambdas.&lt;/p&gt;

&lt;p&gt;More specifically, I’ll walk you through the process of publishing a message to a topic that is being subscribed to by a queue. This is known as topic-to-queue mapping in the PubSub+ world. Once the message is received by the queue, it will be forwarded to API Gateway which will trigger the Lambda function.&lt;/p&gt;

&lt;p&gt;We will be using REST Delivery Points (RDPs) to achieve this. An RDP is a provisioned object on a Message VPN that facilitates message delivery to REST consumers. For our use case, we will need an RDP to link our queue (which will receive the message) to the AWS API Gateway endpoint.&lt;/p&gt;

&lt;p&gt;Here is what the architecture looks like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda1.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CK2c0kUs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda1.png" alt="Integrating PubSub+ Event Broker: Cloud with AWS Lambda via API Gateway"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s begin!&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating an AWS Lambda
&lt;/h2&gt;

&lt;p&gt;Lambdas can be simple or complicated. For this blog post, I am going to create an extremely simple one that simply prints the event that triggered it.&lt;/p&gt;

&lt;p&gt;To create a Lambda function, go to your AWS Console and select &lt;code&gt;Lambda&lt;/code&gt; from Services section. Then, click on &lt;code&gt;Create Function&lt;/code&gt; button on the right side.&lt;/p&gt;

&lt;p&gt;You will be provided with multiple options on how to create a Lambda. You can pick from existing Lambdas available in AWS Serverless Application Repository, build from templates or create a new one from scratch.&lt;/p&gt;

&lt;p&gt;Pick the option &lt;code&gt;Author from scratch&lt;/code&gt;, give your function a name, and pick a runtime environment for your function. I have picked my Runtime environment to be &lt;code&gt;Python 3.8&lt;/code&gt; and my function’s name is &lt;code&gt;myFirstLambda&lt;/code&gt;. Click on &lt;code&gt;Create Function&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda2.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5qbM_gfQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda2.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;** ** Clicking on &lt;code&gt;Create Function&lt;/code&gt; will create your Lambda function and take you to the next screen where you can design/code your function. In the &lt;code&gt;Function code&lt;/code&gt; block, you can add your code, which in this case will simply print the event that triggered the Lambda. Here is the code to do that:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;br&amp;gt;import json&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;def lambda\_handler(event, context):&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;# TODO implement&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;print(\'## EVENT\')&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;print(event)&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;return {&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;\'statusCode\': 200,&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;\'body\': event&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;}&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;strong&amp;gt; &amp;lt;/strong&amp;gt;&amp;lt;br&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Click &lt;code&gt;Save&lt;/code&gt; button on top right to save your changes. You have now created a Lambda function!&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating an API Gateway endpoint
&lt;/h2&gt;

&lt;p&gt;Now that you have your Lambda, we need an endpoint to trigger it. Here’s how you can do that with an &lt;a href="https://console.aws.amazon.com/apigateway/"&gt;API Gateway&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;On the API Gateway page, click on the &lt;code&gt;Create API&lt;/code&gt; button on top right. You will then be presented with different options on types of APIs you can create such as &lt;code&gt;HTTP API&lt;/code&gt;, &lt;code&gt;WebSocket API&lt;/code&gt;, and &lt;code&gt;REST API&lt;/code&gt; (public or private). Pick &lt;code&gt;REST API&lt;/code&gt; (public) and click on &lt;code&gt;Build&lt;/code&gt; button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda3.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3I0SBfqN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda3.png" alt="Integrating PubSub+ Event Broker: Cloud with AWS Lambda via API Gateway"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the next page, leave all of the settings as default and give your API a name (i.e. &lt;code&gt;myFirstAPI&lt;/code&gt;) and click on &lt;code&gt;Create API&lt;/code&gt; button.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Currently, PubSub+ does not support SNI for REST consumers, so make sure your &lt;code&gt;Endpoint Type&lt;/code&gt; is set to &lt;code&gt;Regional&lt;/code&gt;, instead of &lt;code&gt;Edge Optimized&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda4.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wY36tKVC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda4.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, you can create different endpoints under your root endpoint and specify which HTTP methods they support. For example, create one called &lt;code&gt;purchase&lt;/code&gt; which supports &lt;code&gt;POST&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;Click on &lt;code&gt;Actions&lt;/code&gt; and then, &lt;code&gt;Create Resource&lt;/code&gt; and fill in the details:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda5.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3TYBE6BO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda5.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click the &lt;code&gt;Create Resource&lt;/code&gt; button when finished. Then, click on &lt;code&gt;Create Method&lt;/code&gt; and select &lt;code&gt;POST&lt;/code&gt; from the dropdown menu. Click the little circle with checkmark to finish.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda6.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5-ppbnmu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda6.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can now configure what happens when a &lt;code&gt;POST&lt;/code&gt; request is issued against your endpoint. In this case, you’ll want it to trigger your Lambda function.&lt;/p&gt;

&lt;p&gt;Again, keep all the settings as default and select your Lambda function from the dropdown menu:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda7.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Wr4sFQfv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda7.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on &lt;code&gt;Save&lt;/code&gt; to save your changes.&lt;/p&gt;

&lt;p&gt;Now that you’ve designed your API, you need to deploy it to be able to use it. You can also create different &lt;code&gt;Stages&lt;/code&gt; to manage lifecycle of our endpoint.&lt;/p&gt;

&lt;p&gt;Click on &lt;code&gt;Actions&lt;/code&gt; and then, &lt;code&gt;Deploy API&lt;/code&gt; which will pop-up a mini window where you can specify the stage you want to deploy your API to and provide a description for your deployment. Because you don’t have an existing stage, you will see &lt;code&gt;[New Stage]&lt;/code&gt; option when you click on the &lt;code&gt;Deployment stage&lt;/code&gt; dropdown menu.&lt;/p&gt;

&lt;p&gt;Select &lt;code&gt;[New Stage]&lt;/code&gt; and enter information about your stage. I called mine &lt;code&gt;PROD&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda8.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TqtquZKz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda8.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click &lt;code&gt;Deploy&lt;/code&gt; when finished.&lt;/p&gt;

&lt;p&gt;You will now find details about your newly deployed endpoint, specifically, the invoke URL. Mine is &lt;code&gt;https://1v3hgu8bia.execute-api.us-east-1.amazonaws.com/PROD&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You’ve now successfully created an endpoint that will trigger your Lambda function when a &lt;code&gt;POST&lt;/code&gt; request is issued against it. All that’s left to do now is to integrate your endpoint with PubSub+ Event Broker: Cloud!&lt;/p&gt;

&lt;h2&gt;
  
  
  PubSub+ Event Broker: Cloud
&lt;/h2&gt;

&lt;p&gt;If you are unfamiliar with &lt;a href="https://console.solace.cloud/login/new-account"&gt;PubSub+ Event Broker: Cloud&lt;/a&gt;, it is Messaging-as-a-Service provided by Solace. PubSub+ Event Broker: Cloud allows you to easily spin up a PubSub+ Event Broker on any of the major cloud providers. It also has a free tier so you can easily spin up a service to follow along with this post without having to worry about any cost.&lt;/p&gt;

&lt;p&gt;Follow instructions &lt;a href="https://docs.solace.com/Solace-Cloud/cloud-getting-started.htm"&gt;here&lt;/a&gt; on how to create a service on Solace PubSub+ Event Broker: Cloud.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating a Queue with topic subscription
&lt;/h3&gt;

&lt;p&gt;Before you create your RDP, you need to create a queue with the appropriate topic subscription.&lt;/p&gt;

&lt;p&gt;Go to your messaging service, click on the &lt;code&gt;Manage&lt;/code&gt; tab, and then click on the &lt;code&gt;Message VPN&lt;/code&gt; block under &lt;code&gt;PubSub+ Manager Quick Settings&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda9.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KiTSDngk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda9.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That will pop up a management UI for your service which you can use to create your queue. Click on &lt;em&gt;Queues&lt;/em&gt; on the left navigation bar and then click on &lt;code&gt;+Queue&lt;/code&gt; button. Give it a name of the form &lt;code&gt;[rdpname].[consumername]&lt;/code&gt;. This syntax is not mandatory, but it will help you identify which queue is bound to which consumer and for which RDP. Because you haven’t yet created an RDP or a consumer, you can call it whatever you like. I called mine &lt;code&gt;myFirstRDP.myRDPConsumer&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Click &lt;code&gt;Create&lt;/code&gt; button and then leave the settings as default, click &lt;code&gt;Apply&lt;/code&gt;. Your queue has now been created:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda10.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6Mr5oYGm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda10.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you need to add a topic subscription to it. To do that, click on the queue and navigate to &lt;code&gt;Subscriptions&lt;/code&gt;. Click on &lt;code&gt;+ Subscription&lt;/code&gt; and enter &lt;code&gt;POST/PROD/purchase&lt;/code&gt; and then, click on &lt;code&gt;Create&lt;/code&gt;. Note that our topic must be of this syntax: &lt;code&gt;&amp;lt;HTTP_METHOD&amp;gt;/&amp;lt;STAGE&amp;gt;/&amp;lt;endpoint&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating a REST Delivery Point (RDP)
&lt;/h3&gt;

&lt;p&gt;Now that you have your queue ready, you can go ahead and create your RDP. To do that, click on &lt;code&gt;Client Connections&lt;/code&gt; on left navigation bar and then &lt;code&gt;REST&lt;/code&gt;. Then, click on &lt;code&gt;+ REST Delivery Point&lt;/code&gt; button. As decided earlier, we will call our RDP &lt;code&gt;myFirstRDP&lt;/code&gt;. Toggle the &lt;code&gt;Enabled&lt;/code&gt; button to enable the RDP and click &lt;code&gt;Apply&lt;/code&gt;. You will notice that the &lt;code&gt;Operational State&lt;/code&gt; is currently &lt;code&gt;Down&lt;/code&gt; and that’s because you haven’t added a REST consumer yet.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda11.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IZbrcHJe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda11.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on your RDP and navigate to &lt;code&gt;REST Consumers&lt;/code&gt;. Click on &lt;code&gt;+ REST Consumer&lt;/code&gt; and give it a name. We decided earlier (when creating our queue) that your REST consumer will be called &lt;code&gt;myRDPConsumer&lt;/code&gt;. Click &lt;code&gt;Create&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;On the next screen, you will need to provide the host url for your AWS API Gateway endpoint. This URL is just the base URL and should not include &lt;code&gt;/PROD/purchase&lt;/code&gt;. In my case, that URL is &lt;code&gt;1v3hgu8bia.execute-api.us-east-1.amazonaws.com&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The port number should be set to &lt;code&gt;443&lt;/code&gt;. Toggle the button next to TLS Enabled to enable TLS.&lt;/p&gt;

&lt;p&gt;Click on &lt;code&gt;Apply&lt;/code&gt; button to create your consumer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda12.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---vUJrwE1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda12.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on your newly created RDP consumer and navigate to &lt;code&gt;TLS Options&lt;/code&gt; on top. Click on &lt;code&gt;+ Trusted Common Name&lt;/code&gt; and enter &lt;code&gt;*.execute-api.us-east-1.amazonaws.com&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda13.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LxyomxwA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda13.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go back to your RDP and enable it by clicking on the toggle button next to &lt;code&gt;Enabled&lt;/code&gt;. You will notice that the &lt;code&gt;Operational State&lt;/code&gt; has now changed to &lt;code&gt;Up&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda14.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1Vuh3Yie--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda14.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You now need to add your queue binding to your RDP. Click on &lt;code&gt;Queue Bindings&lt;/code&gt; and then on &lt;code&gt;+ Queue Bindings&lt;/code&gt;. Select the queue you created earlier, &lt;code&gt;myFirstRDP.myRDPConsumer&lt;/code&gt;, from the dropdown menu. Click &lt;code&gt;Create&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;On the following page, enter a &lt;code&gt;Post Request Target&lt;/code&gt;. In this case, that would be &lt;code&gt;/PROD/purchase&lt;/code&gt;. Make sure you include the “/” in front.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda15.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SY9xmFyW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda15.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click &lt;code&gt;Apply&lt;/code&gt;. &lt;code&gt;Operation State&lt;/code&gt; of your queue binding should be &lt;code&gt;Up&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda16.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uHZ1KeAP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda16.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding Amazon’s CA Cert
&lt;/h3&gt;

&lt;p&gt;To make sure your TLS settings work, you need to upload Amazon’s CA Cert to your broker. The certificate can be downloaded from &lt;a href="https://www.amazontrust.com/repository/AmazonRootCA1.pem"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To upload the certificate, go back to your service on PubSub+ Event Broker: Cloud and click on the &lt;code&gt;Certificate Authorities&lt;/code&gt; block.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda17.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HQJxWTW0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda17.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on &lt;code&gt;+ Add New&lt;/code&gt;, give it a name, and paste the content in the popup box. Click on &lt;code&gt;Submit&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda18.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LBf1QzNh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda18.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That should be it! We can now test to see if our setup works.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo Time
&lt;/h2&gt;

&lt;p&gt;A quick recap: With the goal of sending a message to PubSub+ Event Broker and have a Lambda triggered by it, you created an RDP which has a REST consumer that points to our AWS API Gateway endpoint and a queue binding which is subscribed to a topic. You AWS API Gateway endpoint is configured to trigger your Lambda function when a POST request is issued.&lt;/p&gt;

&lt;p&gt;So, let’s send a message to our PubSub+ Event Broker and see what happens. You can easily do that by using the &lt;code&gt;Try Me!&lt;/code&gt; app on PubSub+ Event Broker: Cloud. Click on &lt;code&gt;Try Me!&lt;/code&gt; on the left navigation bar and enter your connection information on the Publisher app.&lt;/p&gt;

&lt;p&gt;You can get your credentials by going back to your service and navigating to the &lt;strong&gt;Connect&lt;/strong&gt; tab on the top and then selecting REST.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda19.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dxDMoxfK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda19.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on &lt;code&gt;Connect&lt;/code&gt; once you have entered your connection details in the &lt;code&gt;Publisher&lt;/code&gt; app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda20.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rMkPWwa7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda20.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can now set your &lt;code&gt;Topic&lt;/code&gt; to &lt;code&gt;POST/PROD/purchase&lt;/code&gt; and your &lt;code&gt;Message Content&lt;/code&gt; to a JSON message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;{&amp;lt;br&amp;gt;"body" : "A purchase order has been placed by Solace"&amp;lt;br&amp;gt;}&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda21.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ak8KsxL_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda21.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on &lt;code&gt;Publish&lt;/code&gt; to send the message and see if your Lambda was invoked. To do so, go to your Lambda and click on &lt;code&gt;Monitoring&lt;/code&gt; on top and then, click on &lt;code&gt;View logs in CloudWatch&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda22.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YOPFA0CM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda22.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That will take you to CloudWatch console where you will see a &lt;em&gt;Log Stream&lt;/em&gt;. Click on it to see the contents:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/07/lambda23.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5TxJQGgU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/07/lambda23.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you see something like this, that means your Lambda was successfully invoked, and it consumed the message sent from your Try Me! app. Pretty cool, right? And all with configuration, not coding!&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Hope you enjoyed this post and learned something interesting!&lt;/p&gt;




&lt;p&gt;The post &lt;a href="https://solace.com/blog/event-broker-cloud-lambda-aws-api-gateway/"&gt;Integrating PubSub+ Event Broker: Cloud with Lambda via API Gateway&lt;/a&gt; appeared first on &lt;a href="https://solace.com"&gt;Solace&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>pubsub</category>
      <category>eventbroker</category>
      <category>lambda</category>
      <category>gateway</category>
    </item>
    <item>
      <title>Using Solace PubSub+ with OneTick Time Series Database</title>
      <dc:creator>Himanshu Gupta</dc:creator>
      <pubDate>Wed, 17 Jun 2020 19:27:52 +0000</pubDate>
      <link>https://dev.to/himanshugupta/using-solace-pubsub-with-onetick-time-series-database-l4e</link>
      <guid>https://dev.to/himanshugupta/using-solace-pubsub-with-onetick-time-series-database-l4e</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--b1V39dCP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/05/one-tick-blog-post-featured-image.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--b1V39dCP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/05/one-tick-blog-post-featured-image.jpg" alt=""&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;OneTick is a time-series database that is heavily used in financial services by hedge funds, brokerages and investment banks. &lt;a href="https://www.onetick.com/"&gt;OneMarketData&lt;/a&gt;, the maker of OneTick, describes it as “the premier enterprise-wide solution for tick data capture, streaming analytics, data management and research.” OneTick captures, compresses, archives, and provides uniform access to global historical data, up to and including the latest tick.&lt;/p&gt;

&lt;p&gt;I myself have used OneTick for almost 5 years and found it to be a very nicely packaged solution thanks to built-in collectors for popular feeds such as Reuters’ Elektron and Bloomberg’s MBPIPE. OneTick also comes with a GUI that makes it easy for non-developers, such as researchers and portfolio managers, to write advanced queries using pre-built &lt;strong&gt;event processors&lt;/strong&gt; (EPs). The GUI can be used to design queries that you can run from the GUI or APIs that OneTick supports, such as Python.&lt;/p&gt;

&lt;p&gt;For example, here is a simple query that would select trade data for AAPL where price is greater than or equal to 21.5 (data is from 2003). In SQL, this would be &lt;code&gt;select * from &amp;lt;database_name&amp;gt; where symbol="AAPL" and price &amp;gt;= 21.5&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;OneTick comes with a &lt;code&gt;DEMO&lt;/code&gt; database that I will be using for my examples. Here is what the query looks like in OneTick GUI:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/05/onetick1.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lqgi8IVM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/05/onetick1-1024x410.png" alt="OneTick GUI query"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you run this query, you will see the result in OneTick’s GUI.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/05/onetick2.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IbSUFjFP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/05/onetick2-1024x308.png" alt="OneTick GUI query results"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That’s useful information, but what if…&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You wanted to &lt;em&gt;stream&lt;/em&gt; this data to your real-time event-driven applications?&lt;/li&gt;
&lt;li&gt;You wanted to publish the data once and have many recipients get it?&lt;/li&gt;
&lt;li&gt;You wanted to let downstream applications retrieve data via open APIs and message protocols?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Solace &lt;a href="https://solace.com/products/event-broker/"&gt;PubSub+ Event Broker&lt;/a&gt; makes all of that possible!&lt;/p&gt;

&lt;h2&gt;
  
  
  How PubSub+ Can Help OneTick Developers
&lt;/h2&gt;

&lt;p&gt;Here are some of the many ways &lt;a href="https://solace.com/onetick/"&gt;OneTick developers can leverage PubSub+&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Consume data from a central distribution bus&lt;/strong&gt;
Many financial companies capture market data from external vendors and distribute it to their applications internally via PubSub+. OneTick developers can now natively consume the data and store it for later use.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Distribute data from OneTick to other applications&lt;/strong&gt;
Instead of delivering data individually to each client/application, OneTick developers can leverage pub/sub messaging pattern to publish data once and have it consumed multiple times.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Migrate to the cloud&lt;/strong&gt;
Have you been thinking about moving your applications and/or data to the cloud? With PubSub+ you can easily give cloud-native applications access to your high-volume data stored in on-prem OneTick instance using an &lt;a href="https://solace.com/what-is-an-event-mesh/"&gt;event mesh&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Easier integration&lt;/strong&gt;
PubSub+ supports &lt;a href="https://solace.com/products/apis-protocols/"&gt;open APIs and protocols&lt;/a&gt; which make it a perfect option for integrating applications. Your applications can now use a variety of APIs to publish to and subscribe data from OneTick.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Replay messages&lt;/strong&gt;
Are you tired of losing critical data such as order flows when your applications crash? &lt;a href="https://docs.solace.com/Overviews/Message-Replay-Overview.htm"&gt;Replay&lt;/a&gt; functionality helps protect applications by giving them the ability to correct database issues they might have arising from events such as misconfiguration, application crashes, or corruption, by redelivering data to the applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automate notifications&lt;/strong&gt;
It’s always a challenge to ensure all of the consumers are aware of any data issues whether it be an exchange outage leading to data gaps or delay in an ETL process. With PubSub+, OneTick developers can automate the publication of notifications related to their databases and broadcast it to the interested subscribers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Running an Instance of PubSub+ Event Broker
&lt;/h2&gt;

&lt;p&gt;In the rest of this post, I am going to show you how you can take data from your OneTick database and publish it to PubSub+, and vice versa. To follow along you will need access to an instance of PubSub+. If you don’t, there are two free ways to set up an instance:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install a &lt;a href="https://docs.solace.com/Solace-SW-Broker-Set-Up/Docker-Containers/Set-Up-Docker-Container-Image.htm"&gt;Docker container&lt;/a&gt; locally or in the cloud&lt;/li&gt;
&lt;li&gt;Set up a dev instance on &lt;a href="https://console.solace.cloud/login/new-account"&gt;Solace Cloud&lt;/a&gt; (easiest way to get started)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Please post on &lt;a href="https://solace.community/"&gt;Solace Community&lt;/a&gt; if you have any issues setting up an instance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Publishing data from OneTick to PubSub+
&lt;/h3&gt;

&lt;p&gt;OneTick makes it extremely easy for you to publish data to PubSub+ by simply using a built-in &lt;strong&gt;event processor&lt;/strong&gt; (EP). The EP is called &lt;code&gt;WRITE_TO_SOLACE&lt;/code&gt; and is part of OneTick’s Output Adapters (see OneTick docs: &lt;code&gt;docs/ep_guide/EP/OutputAdapters.htm&lt;/code&gt;) which contains other EPs such as &lt;code&gt;WRITE_TEXT&lt;/code&gt;, &lt;code&gt;WRITE_TO_RAW&lt;/code&gt;, and &lt;code&gt;WRITE_TO_ONETICK_DB&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To publish results of our previous query to PubSub+, we would simply add &lt;code&gt;WRITE_TO_SOLACE&lt;/code&gt; EP at the end of our query and fill in appropriate connection and other details. Here is what the EP parameters look like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/05/Onetick3.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CcluQYwF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/05/Onetick3-193x300.png" alt="onetick event processor parameters"&gt;&lt;/a&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/05/onetick4.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4xA4k_yb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/05/onetick4-300x234.png" alt="event processor parameters"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can find details about the &lt;code&gt;WRITE_TO_SOLACE&lt;/code&gt; EP and its parameters in OneTick docs (&lt;code&gt;docs/ep_guide/EP/OMD/WRITE_TO_SOLACE.htm&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;The first few fields in the EP are for your PubSub+ connection details such as &lt;code&gt;HOSTNAME&lt;/code&gt;, &lt;code&gt;VPN&lt;/code&gt;, &lt;code&gt;USERNAME&lt;/code&gt;, and &lt;code&gt;PASSWORD&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The EP supports both &lt;strong&gt;direct&lt;/strong&gt; and &lt;strong&gt;guaranteed&lt;/strong&gt; message delivery. Direct messages are suitable for high throughput/low latency use cases such as market data distribution, and guaranteed messages are appropriate for critical messages that can’t be lost, such as order flow. You can learn more about the two delivery modes &lt;a href="https://docs.solace.com/PubSub-Basics/Core-Concepts-Message-Delivery-Modes.htm"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The EP also allows you to specify the &lt;code&gt;ENDPOINT&lt;/code&gt; you would like to publish data to, and the &lt;code&gt;ENDPOINT_TYPE&lt;/code&gt; where you can specify if it is a topic or a queue. Publishing to a topic supports the pub/sub messaging pattern where your application publishes once to the topic and many applications can subscribe to that topic. On the other hand, publishing to a queue is point-to-point messaging because only the consumer binding to that specific queue can consume data published to it. Needless to say, we encourage clients to use the pub/sub messaging pattern as it provides more flexibility.&lt;/p&gt;

&lt;p&gt;For this example today, I will publish to this topic: &lt;code&gt;EQ/US/&amp;lt;security_name&lt;/code&gt;; such as &lt;code&gt;EQ/US/AAPL&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Finally, you will notice that the EP allows users to specify the message format via &lt;code&gt;MSG_FORMAT&lt;/code&gt; field. Currently, you can only pick from &lt;code&gt;NAME_VALUE_PAIRS&lt;/code&gt; and &lt;code&gt;BINARY&lt;/code&gt;, but OneTick will support additional message formats soon.&lt;/p&gt;

&lt;h3&gt;
  
  
  Configuring Subscriptions on PubSub+ Broker
&lt;/h3&gt;

&lt;p&gt;Before publishing data to PubSub+, you need to determine how it will be consumed. Applications can either subscribe directly to the topic we are publishing to, or map the topic(s) to a queue and consume them from there. Using a queue introduces persistence so if your consumer disconnects abruptly, your messages won’t be lost. For our example, we will consume from a queue called &lt;code&gt;onetick_queue&lt;/code&gt; that I have created from PubSub+’s UI:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/05/onetick5.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FYvIoSBm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/05/onetick5-1024x192.png" alt="PubSub+ onetick queue"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;PubSub+ allows you to map one or many topics to a queue, which means your consumer only needs to worry about binding to one queue and it can have messages being published to different topics ordered and delivered to that queue.&lt;/p&gt;

&lt;p&gt;Additionally, PubSub+ also supports rich hierarchical topics and wildcards so you can dynamically filter the data you are interested in consuming. PubSub+ supports two wildcards: &lt;code&gt;*&lt;/code&gt; lets you abstract away one topic level, and &lt;code&gt;&amp;gt;&lt;/code&gt; lets you abstract away one or more levels. So, if you wanted to subscribe to all the data for equities, you can simply subscribe to &lt;code&gt;EQ/&amp;amp;gt&lt;/code&gt;; and if you wanted to subscribe to data for &lt;code&gt;AAPL&lt;/code&gt; from different regions/venues, you could subscribe to &lt;code&gt;EQ/*/AAPL&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You can learn more about Solace topics and wildcards &lt;a href="https://docs.solace.com/PubSub-Basics/Understanding-Topics.htm"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I have subscribed my queue to topic: &lt;code&gt;EQ/US/AAPL&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/05/onetick6.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_xpG3b0C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/05/onetick6-1024x311.png" alt="subscribe queue to a topic"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With that done, you’re ready to run the query!&lt;/p&gt;

&lt;p&gt;Once you have run your OneTick query, go to the PubSub+ UI and note that messages are in the queue.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/05/onetick7.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QKvZw3ev--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/05/onetick7-1024x272.png" alt="messages in the queue"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, there are 8,278 messages in our queue.&lt;/p&gt;

&lt;p&gt;This is how easy it is to publish messages from OneTick to PubSub+!&lt;/p&gt;

&lt;h3&gt;
  
  
  Writing Data from PubSub+ to OneTick
&lt;/h3&gt;

&lt;p&gt;Now it’s time to consume data from PubSub+ and write it to a OneTick database. To be efficient you can use the data in the &lt;code&gt;onetick_queue&lt;/code&gt; to write to OneTick db.&lt;/p&gt;

&lt;p&gt;To read data from PubSub+, OneTick provides the &lt;code&gt;omd::OneTickSolaceConsumer&lt;/code&gt; interface via its C++ API. Use this interface to connect to a Solace broker, make subscriptions, process received messages, and propagate those messages to the Custom Serialization interface.&lt;/p&gt;

&lt;p&gt;To make things simple for us, OneTick distribution comes with a C++ example (&lt;code&gt;examples/cplusplus/solace_consumer.cpp&lt;/code&gt;) that shows you how to do that. You can go through the code to see how to use the OneTick/Solace API but for the purpose of this post, we will simply run the code. However, before we can write the data from PubSub+ to a OneTick database, we need to create/configure that database.&lt;/p&gt;

&lt;p&gt;I have created a database called solace by following these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create data directory for our database. I have created mine at: &lt;code&gt;C:/omd/one_market/data/data/solace&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Create a database entry in your &lt;code&gt;locator&lt;/code&gt; file. Here is my locator entry for &lt;code&gt;solace&lt;/code&gt; db:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;db ID="solace" SYMBOLOGY="SOLACE" &amp;gt;&amp;lt;LOCATIONS&amp;gt;&amp;lt;location access\_method="file" location="C:\omd\data\solace" start\_time="20000101000000" end\_time="20300101000000" /&amp;gt;&amp;lt;/LOCATIONS&amp;gt;&amp;lt;RAW\_DATA&amp;gt;&amp;lt;RAW\_DB ID="PRIMARY" prefix="solace."&amp;gt;&amp;lt;LOCATIONS&amp;gt;&amp;lt;location mount="mount1" access\_method="file" location="C:\omd\data\solace\raw\_data" start\_time="20000101000000" end\_time="20300101000000" /&amp;gt;&amp;lt;/LOCATIONS&amp;gt;&amp;lt;/RAW\_DB&amp;gt; &amp;lt;/RAW\_DATA&amp;gt;&amp;lt;/db&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now that we have our database configured, we are ready to run our sample code. We will need to provide the following details to run the example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PubSub+ connection details: host:port, username, password, vpn&lt;/li&gt;
&lt;li&gt;endpoint: which topic/queue to subscribe to&lt;/li&gt;
&lt;li&gt;OneTick db: name of database we will be writing data to&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the queue doesn’t exist, our code will administratively create it and map topics to it. In our case, we already have a queue (&lt;code&gt;onetick_queue&lt;/code&gt;) that we will be consuming from.&lt;/p&gt;

&lt;p&gt;As soon as we run the example, it will consume all the messages from the queue:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;C:\omd\one\_market\_data\one\_tick\examples\cplusplus&amp;gt;solace\_consumer.exe -hostname &amp;lt;host\_name&amp;gt;.messaging.solace.cloud -username &amp;lt;username&amp;gt; -password &amp;lt;password&amp;gt; -vpn himanshu-demo-dev -queue onetick\_queue -dbname solace20200509021426 INFO: Relevant section in locator &amp;lt;DB DAY\_BOUNDARY\_TZ="GMT" ID="solace" SYMBOLOGY="SOLACE" TIME\_SERIES\_IS\_COMPOSITE="YES" &amp;gt; &amp;lt;LOCATIONS &amp;gt; &amp;lt;LOCATION ACCESS\_METHOD="file" END\_TIME="20300101000000" LOCATION="C:\omd\data\solace" START\_TIME="20000101000000" /&amp;gt; &amp;lt;/LOCATIONS&amp;gt; &amp;lt;RAW\_DATA &amp;gt; &amp;lt;RAW\_DB ID="PRIMARY" PREFIX="solace." &amp;gt; &amp;lt;LOCATIONS &amp;gt; &amp;lt;LOCATION ACCESS\_METHOD="file" END\_TIME="20300101000000" LOCATION="C:\omd\data\solace\raw\_data" MOUNT="mount1" START\_TIME="20000101000000" /&amp;gt; &amp;lt;/LOCATIONS&amp;gt; &amp;lt;/RAW\_DB&amp;gt; &amp;lt;/RAW\_DATA&amp;gt; &amp;lt;/DB&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;After running the example, you will notice new raw data files have been created:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;C:\omd\data\solace\raw\_data&amp;gt;dir Directory of C:\omd\data\solace\raw\_data05/11/2020 05:41 PM &amp;lt;DIR&amp;gt; .05/11/2020 05:41 PM &amp;lt;DIR&amp;gt; ..05/11/2020 05:41 PM 245,644 solace.mount1.2020051121403905/11/2020 05:41 PM 0 solace\_mount1\_lock 2 File(s) 245,644 bytes 2 Dir(s) 172,622,315,520 bytes free
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now, we need to run OneTick’s &lt;code&gt;native_loader_daily.exe&lt;/code&gt; to archive the data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;C:\omd\one\_market\_data\one\_tick\bin&amp;gt;native\_loader\_daily.exe -dbname solace -datadate 2020051120200511214237 INFO: Native daily loader started20200511214237 INFO:  BuildNumber 20200420120000Command and arguments: native\_loader\_daily.exe  -dbname solace -datadate 20200511...20200511214237 INFO: Picked up file C:\omd\data\solace\raw\_data/solace.mount1.20200511214039 in raw db PRIMARY20200511214237 INFO: Total processed messages: 8,468 (1,721,228 bytes)20200511214237 INFO: Messages processed in last 0.046 seconds: 8,468 (1,721,228 bytes) at 184,652.958 msg/s (37,533,046.948 bytes/s)20200511214237 INFO: Last measured message latency: NaN20200511214237 INFO: Total processed messages: 8,468 (1,721,228 bytes)20200511214237 INFO: Messages processed in last 0.005 seconds: 0 (0 bytes) at 0.000 msg/s (0.000 bytes/s)20200511214237 INFO: Last measured message latency: NaN20200511214237 INFO: persisting sorted batch20200511214237 INFO: done persisting sorted batch20200511214237 INFO: done persisting sorted batches for database solace, starting phase 2 of database load. Total symbols to load: 1, number of batches: 120200511214237 INFO: beginning sorted files cleanup20200511214237 INFO: done with sorted files cleanup20200511214237 INFO: loading index file; total records: 120200511214237 INFO: loading symbol file20200511214237 INFO: renaming old archive directory, if exists20200511214237 INFO: Load Complete for database solace for 20200511Total ticks 8278Total symbols 120200511214237 INFO: Processing time: 1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;As you can see, 8,278 ticks have been archived – which is the same number of messages that were in the queue. You can now go to OneTick GUI and query the data from &lt;code&gt;solace&lt;/code&gt; db:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/05/onetick8.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FDc9Q6oN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/05/onetick8-1024x264.png" alt="OneATick GUI and query the data from solace database"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That’s it!&lt;/p&gt;

&lt;p&gt;I’ve shown you how easy it is to publish data from OneTick to PubSub+, read it back, and write to a OneTick database.&lt;/p&gt;

&lt;p&gt;We are excited to have OneTick users like yourself take advantage of features like &lt;strong&gt;rich hierarchical topics&lt;/strong&gt; , &lt;strong&gt;wildcards&lt;/strong&gt; , &lt;strong&gt;support for open APIs and protocols&lt;/strong&gt; and the dynamic message routing that enables &lt;strong&gt;event mesh&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If you would like to learn more about the API, please reach out to your OneTick account manager or support. If you would like to learn more about how to get started with PubSub+, please reach out to us &lt;a href="https://solace.com/contact/"&gt;here&lt;/a&gt; or check out our &lt;a href="https://solace.com/onetick/"&gt;Solace with OneTick&lt;/a&gt; page.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://solace.com/blog/pubsub-plus-with-onetick/"&gt;Using Solace PubSub+ with OneTick Time Series Database&lt;/a&gt; appeared first on &lt;a href="https://solace.com"&gt;Solace&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>onetick</category>
      <category>pubsub</category>
      <category>timeseries</category>
      <category>eventbroker</category>
    </item>
    <item>
      <title>Integrating PubSub+ Cloud with Lambda via API Gateway</title>
      <dc:creator>Himanshu Gupta</dc:creator>
      <pubDate>Thu, 21 May 2020 14:45:35 +0000</pubDate>
      <link>https://dev.to/himanshugupta/integrating-pubsub-cloud-with-lambda-via-api-gateway-57d1</link>
      <guid>https://dev.to/himanshugupta/integrating-pubsub-cloud-with-lambda-via-api-gateway-57d1</guid>
      <description>&lt;p&gt;Serverless architecture is all the rage these days and nothing screams serverless like AWS Lambda. When Lambda was announced a few years ago by AWS, it caused quite a bit of confusion but slowly it has gained popularity and has become analogous to serverless architecture.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;AWS Lambda&lt;/strong&gt;  is a serverless compute service that runs your code in response to events and automatically manages the underlying compute resources for you. &lt;/p&gt;

&lt;p&gt;&lt;cite&gt;&lt;a href="https://aws.amazon.com/lambda/features/" rel="noreferrer noopener"&gt;AWS&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Lambdas are super powerful because they can be easily triggered and scaled without having to worry about the underlying infrastructure.&lt;/p&gt;

&lt;p&gt;In this post, I would like to show you how you can send a message to a PubSub+ broker running as a managed service on PubSub+ Cloud and use it to trigger a lambda through AWS’s API Gateway. And all of this without any code, except for the code you need for your Lambdas.&lt;/p&gt;

&lt;p&gt;More specifically, we will publish a message to a topic that is being subscribed to by a queue. This is known as topic-to-queue mapping in the PubSub+ world. Once the message is received by the queue, it will be forwarded to API Gateway which will trigger the Lambda function.&lt;/p&gt;

&lt;p&gt;We will be using REST Delivery Points (RDPs) to achieve this. An RDP is a provisioned object on a Message VPN that facilitates message delivery to REST consumers. For our use case, we will need an RDP to link our queue (which will receive the message) to the AWS API Gateway endpoint.&lt;/p&gt;

&lt;p&gt;Here is what our architecture looks like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wO4yg1ou--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/solace_aws_architecture-1024x261.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wO4yg1ou--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/solace_aws_architecture-1024x261.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s begin!&lt;/p&gt;

&lt;h4&gt;
  
  
  Creating an AWS Lambda
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eDl1j0fr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/lambda-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eDl1j0fr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/lambda-1.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Lambdas&lt;/em&gt; can be extremely simple or highly complicated. For this blog post, I am going to create an extremely simple one that simply prints the event that triggered it.&lt;/p&gt;

&lt;p&gt;To create a Lambda function, go to your AWS Console and select &lt;code&gt;Lambda&lt;/code&gt; from Services section. Then, click on &lt;code&gt;Create Function&lt;/code&gt; button on the right side.&lt;/p&gt;

&lt;p&gt;You will be provided with multiple options on how to create a Lambda. You can pick from existing Lambdas available in AWS Serverless Application Repository, build from templates or create a new one from scratch.&lt;/p&gt;

&lt;p&gt;Pick the option &lt;code&gt;Author from scratch&lt;/code&gt;, give your function a name, and pick a runtime environment for your function. I have picked my Runtime environment to be &lt;code&gt;Python 3.8&lt;/code&gt; and my function’s name is &lt;code&gt;myFirstLambda&lt;/code&gt;. Click on &lt;code&gt;Create Function&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--I0e-bi3d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-1024x519.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--I0e-bi3d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-1024x519.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Clicking on &lt;code&gt;Create Function&lt;/code&gt; will create your Lambda function and will take you to the next page where you can design/code your function. In the &lt;code&gt;Function code&lt;/code&gt; block, you can add your code. As mentioned earlier, we will only be printing our event that triggered the Lambda. Here is the code to do that:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import json

def lambda_handler(event, context):
    # TODO implement
    print('## EVENT')
    print(event)
    return {
        'statusCode': 200,
        'body': event
    }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Click &lt;code&gt;Save&lt;/code&gt; button on top right to save your changes. We have now created a Lambda function!&lt;/p&gt;

&lt;h4&gt;
  
  
  Creating an API Gateway endpoint
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DXdkapiX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/aws-api-gateway-icon-1024x1024.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DXdkapiX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/aws-api-gateway-icon-1024x1024.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that we have our Lambda, we need an endpoint to trigger it. We will use &lt;a href="https://console.aws.amazon.com/apigateway/"&gt;API Gateway&lt;/a&gt; to do that.&lt;/p&gt;

&lt;p&gt;On the API Gateway page, click on the &lt;code&gt;Create API&lt;/code&gt; button on top right. You will then be presented with different options on types of APIs you can create such as &lt;code&gt;HTTP API&lt;/code&gt;, &lt;code&gt;WebSocket API&lt;/code&gt;, and &lt;code&gt;REST API&lt;/code&gt; (public or private). Pick &lt;code&gt;REST API&lt;/code&gt; (public) and click on &lt;code&gt;Build&lt;/code&gt; button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--50Yl1xBm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-1-1024x427.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--50Yl1xBm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-1-1024x427.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the next page, leave all of the settings as default and give your API a name (i.e. &lt;code&gt;myFirstAPI&lt;/code&gt;) and click on &lt;code&gt;Create API&lt;/code&gt; button.&lt;/p&gt;

&lt;p&gt;Note: Currently, PubSub+ does not support SNI for REST consumers so we need to make sure that our &lt;code&gt;Endpoint Type&lt;/code&gt; is set to &lt;code&gt;Regional&lt;/code&gt;, instead of &lt;code&gt;Edge Optimized&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MmwCUV6E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-2-1024x587.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MmwCUV6E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-2-1024x587.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, we can create different endpoints under our root endpoint and specify which HTTP methods they support. For example, let’s create one called &lt;code&gt;purchase&lt;/code&gt; which supports &lt;code&gt;POST&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;Click on &lt;code&gt;Actions&lt;/code&gt; and then, &lt;code&gt;Create Resource&lt;/code&gt; and fill in the details:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KzfTCH1p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-3-1024x380.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KzfTCH1p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-3-1024x380.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click the &lt;code&gt;Create Resource&lt;/code&gt; button when finished. Then, click on &lt;code&gt;Create Method&lt;/code&gt;and select &lt;code&gt;POST&lt;/code&gt; from dropdown menu. Click the little circle with checkmark to finish.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nm39PVbx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nm39PVbx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-4.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can now configure what happens when a &lt;code&gt;POST&lt;/code&gt; request is issued against your endpoint. We would like it to trigger our Lambda function.&lt;/p&gt;

&lt;p&gt;Again, keep all the settings as default and select your Lambda function from dropdown menu:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--g8Ips91G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-5-1024x419.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--g8Ips91G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-5-1024x419.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on &lt;code&gt;Save&lt;/code&gt; to save your changes.&lt;/p&gt;

&lt;p&gt;Now that we have designed our API, we need to deploy it to be able to use it. We can also create different &lt;code&gt;Stages&lt;/code&gt; to manage lifecycle of our endpoint.&lt;/p&gt;

&lt;p&gt;Click on &lt;code&gt;Actions&lt;/code&gt; and then, &lt;code&gt;Deploy API&lt;/code&gt; which will pop-up a mini window where you can specify the stage you want to deploy your API to and provide a description for your deployment. Because we don’t have an existing stage, you will see &lt;code&gt;[New Stage]&lt;/code&gt; option when you click on &lt;code&gt;Deployment stage&lt;/code&gt; dropdown menu.&lt;/p&gt;

&lt;p&gt;Select &lt;code&gt;[New Stage]&lt;/code&gt; and enter information about your stage. I am calling mine: &lt;code&gt;PROD&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YGstcZ9e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-6-1024x652.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YGstcZ9e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-6-1024x652.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click &lt;code&gt;Deploy&lt;/code&gt; when finished.&lt;/p&gt;

&lt;p&gt;You will now find details about your newly deployed endpoint, specifically, the invoke URL. Mine is: &lt;code&gt;https://1v3hgu8bia.execute-api.us-east-1.amazonaws.com/PROD&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We have now successfully created an endpoint which will trigger our Lambda function when a &lt;code&gt;POST&lt;/code&gt; request is issued against it. All that’s left to do now is to integrate our endpoint with PubSub+ Cloud!&lt;/p&gt;

&lt;h4&gt;
  
  
  PubSub+ Cloud
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZOa9cxTV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2019/10/solace_pubsub.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZOa9cxTV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2019/10/solace_pubsub.jpg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are unfamiliar with &lt;a href="https://console.solace.cloud/login/new-account"&gt;PubSub+ Cloud&lt;/a&gt;, it is Messaging-as-a-Service provided by Solace. PubSub+ Cloud allows you to easily spin up a PubSub+ event broker on any of the major cloud providers. It also has a free tier so you can easily spin up a service to follow along with this post without having to worry about any cost.&lt;/p&gt;

&lt;p&gt;Follow instructions &lt;a href="https://docs.solace.com/Solace-Cloud/cloud-getting-started.htm"&gt;here&lt;/a&gt; on how to create a service on Solace Cloud.&lt;/p&gt;

&lt;h4&gt;
  
  
  Creating a Queue with topic subscription
&lt;/h4&gt;

&lt;p&gt;Before we create our RDP, we need to create a queue with the appropriate topic subscription.&lt;/p&gt;

&lt;p&gt;Go to your messaging service, click on &lt;code&gt;Manage&lt;/code&gt; tab, and then click on &lt;code&gt;Message VPN&lt;/code&gt; block under &lt;code&gt;PubSub+ Manager Quick Settings&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ils7CH1T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-7-1024x519.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ils7CH1T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-7-1024x519.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That will popup a management UI for your service which you can use to create your queue. Click on &lt;code&gt;Queues&lt;/code&gt; on the left navigation bar and then click on &lt;code&gt;+ Queue&lt;/code&gt; button. Give it a name of the form &lt;code&gt;[rdpname].[consumername]&lt;/code&gt;. This syntax is not mandatory but it will help you identify which queue is bound to which consumer and for which RDP. Because we haven’t created either an RDP or a consumer, you can call it whatever you like. I am calling mine: &lt;code&gt;myFirstRDP.myRDPConsumer&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Click &lt;code&gt;Create&lt;/code&gt; button and then leave the settings as default, click &lt;code&gt;Apply&lt;/code&gt;. Your queue has now been created:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--u_QUj29W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-8-1024x178.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--u_QUj29W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-8-1024x178.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we need to add a topic subscription to it. To do that, click on the queue and navigate to &lt;code&gt;Subscriptions&lt;/code&gt;. Click on &lt;code&gt;+ Subscription&lt;/code&gt; and enter &lt;code&gt;POST/PROD/purchase&lt;/code&gt; and then, click on &lt;code&gt;Create&lt;/code&gt;. Note that our topic must be of this syntax: &lt;code&gt;&amp;lt;HTTP_METHOD&amp;gt;/&amp;lt;STAGE&amp;gt;/&amp;lt;endpoint&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Creating a REST Delivery Point (RDP)
&lt;/h4&gt;

&lt;p&gt;Now that we have our queue ready, we can go ahead and create our RDP. To do that, click on &lt;code&gt;Client Connections&lt;/code&gt; on left navigation bar and then &lt;code&gt;REST&lt;/code&gt;. Then, click on &lt;code&gt;+ REST Delivery Point&lt;/code&gt; button. As decided earlier, we will call our RDP: &lt;code&gt;myFirstRDP&lt;/code&gt;. Toggle the &lt;code&gt;Enabled&lt;/code&gt; button to enable the RDP and click &lt;code&gt;Apply&lt;/code&gt;. You will notice that the &lt;code&gt;Operational State&lt;/code&gt; is currently &lt;code&gt;Down&lt;/code&gt; and that’s because we haven’t added a REST consumer yet.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--viHZTcPK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-9-1024x205.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--viHZTcPK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-9-1024x205.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on your RDP and navigate to &lt;code&gt;REST Consumers&lt;/code&gt;. Click on &lt;code&gt;+ REST Consumer&lt;/code&gt; and give it a name. We decided earlier (when creating our queue) that our REST consumer will be called: &lt;code&gt;myRDPConsumer&lt;/code&gt;. Click &lt;code&gt;Create&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;On the next page, we will need to provide the host url for our AWS API Gateway endpoint. This URL is just the base URL and should not include &lt;code&gt;/PROD/purchase&lt;/code&gt;. In my case, that URL is: &lt;code&gt;1v3hgu8bia.execute-api.us-east-1.amazonaws.com&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The port number should be set to &lt;code&gt;443&lt;/code&gt;. Toggle the button next to &lt;code&gt;TLS Enabled&lt;/code&gt; to enable TLS.&lt;/p&gt;

&lt;p&gt;Click on &lt;code&gt;Apply&lt;/code&gt; button to create your consumer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UHblPEZQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-11-1024x470.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UHblPEZQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-11-1024x470.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on your newly created RDP consumer and navigate to &lt;code&gt;TLS Options&lt;/code&gt; on top. Click on &lt;code&gt;+ Trusted Common Name&lt;/code&gt; and enter &lt;code&gt;*.execute-api.us-east-1.amazonaws.com&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eEtiQ9Nb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-12-1024x318.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eEtiQ9Nb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-12-1024x318.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go back to your RDP and enable it by clicking on the toggle button next to &lt;code&gt;Enabled&lt;/code&gt;. You will notice that the &lt;code&gt;Operational State&lt;/code&gt; has now changed to &lt;code&gt;Up&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Osz5ZAK_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-13-1024x190.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Osz5ZAK_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-13-1024x190.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We now need to add our queue binding to our RDP. Click on &lt;code&gt;Queue Bindings&lt;/code&gt; and then, &lt;code&gt;+ Queue Bindings&lt;/code&gt;. Select the queue we had created earlier, &lt;code&gt;myFirstRDP.myRDPConsumer&lt;/code&gt;, from the dropdown menu. Click Create.&lt;/p&gt;

&lt;p&gt;On the following page, enter a &lt;code&gt;Post Request Target&lt;/code&gt;. In our case, that would be &lt;code&gt;/PROD/purchase&lt;/code&gt;. Make sure you include the “/” in front.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Pt1RzQyi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-14-1024x215.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Pt1RzQyi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-14-1024x215.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click &lt;code&gt;Apply&lt;/code&gt;. &lt;code&gt;Operation State&lt;/code&gt; of your queue binding should be &lt;code&gt;Up&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7rekPNVd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-15-1024x201.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7rekPNVd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-15-1024x201.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Adding Amazon’s CA Cert
&lt;/h4&gt;

&lt;p&gt;To make sure our TLS settings work, we need to upload Amazon’s CA Cert to our broker. The certificate can be downloaded from &lt;a href="https://www.amazontrust.com/repository/AmazonRootCA1.pem"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To upload the certificate, go back to your service on PubSub+ Cloud and click on &lt;code&gt;Certificate Authorities&lt;/code&gt; block.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ouVs58-p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-16-1024x326.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ouVs58-p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-16-1024x326.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on &lt;code&gt;+ Add New&lt;/code&gt;, give it a name, and paste the content in the popup box. Click on &lt;code&gt;Submit&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dVnFlyRh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-17-1024x608.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dVnFlyRh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-17-1024x608.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That should be it! We can now test to see if our setup works.&lt;/p&gt;

&lt;h4&gt;
  
  
  Demo Time
&lt;/h4&gt;

&lt;p&gt;A quick recap. Our goal is to send a message to PubSub+ broker and have a lambda triggered by it. To achieve this, we created an RDP which has a REST consumer that points to our AWS API Gateway endpoint and a queue binding which is subscribed to a topic. Our AWS API Gateway endpoint is configured to trigger our Lambda function when a POST request is issued.&lt;/p&gt;

&lt;p&gt;So, let’s send a message to our PubSub+ broker and see what happens. We can easily do that by using the &lt;code&gt;Try Me!&lt;/code&gt; app on PubSub+ Cloud. Click on &lt;code&gt;Try Me!&lt;/code&gt; on left navigation bar and enter your connection information on the Publisher app.&lt;/p&gt;

&lt;p&gt;You can get your credentials by going back to your service and navigating to Connect tab on top and then selecting REST.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JrnfG1Hr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-19-1024x185.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JrnfG1Hr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-19-1024x185.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on &lt;code&gt;Connect&lt;/code&gt; once you have entered your connection details in the &lt;code&gt;Publisher&lt;/code&gt; app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t1GU7Rms--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-18-1024x800.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t1GU7Rms--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-18-1024x800.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can now set our &lt;code&gt;Topic&lt;/code&gt; to &lt;code&gt;POST/PROD/purchase&lt;/code&gt; and our &lt;code&gt;Message Content&lt;/code&gt; to a JSON message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
"body" : "A purchase order has been placed by Solace"
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L_G7RIWB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-21-998x1024.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--L_G7RIWB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-21-998x1024.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on &lt;code&gt;Publish&lt;/code&gt; to send the message. Now, we need to verify whether our Lambda was invoked. To do so, we can go to our Lambda and click on &lt;code&gt;Monitoring&lt;/code&gt; on top and then, click on &lt;code&gt;View logs in CloudWatch.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--56xRdqqx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-24-1024x125.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--56xRdqqx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-24-1024x125.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That will take you to CloudWatch console where you will see a &lt;code&gt;Log Stream&lt;/code&gt;. Click on it to see the contents:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5Ng3wPNZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-25-1024x301.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5Ng3wPNZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://abitdeployed.com/wp-content/uploads/2020/05/image-25-1024x301.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, our Lambda was successfully invoked and it consumed the message we sent it from our Try Me! app. We were able to accomplish this with mostly configuration settings and without having to code anything.&lt;/p&gt;

&lt;p&gt;Hope you enjoyed this post and learned something interesting!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>pubsub</category>
      <category>serverless</category>
      <category>lambda</category>
    </item>
    <item>
      <title>What are the Differences Between IaaS, PaaS, and SaaS?</title>
      <dc:creator>Himanshu Gupta</dc:creator>
      <pubDate>Thu, 21 May 2020 06:26:19 +0000</pubDate>
      <link>https://dev.to/solacedevs/what-are-the-differences-between-iaas-paas-and-saas-47o0</link>
      <guid>https://dev.to/solacedevs/what-are-the-differences-between-iaas-paas-and-saas-47o0</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2017%2F04%2FDARK_How-to-Integrate-Cloud-and-On-Premise-Apps.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2017%2F04%2FDARK_How-to-Integrate-Cloud-and-On-Premise-Apps.png"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;As a solutions architect, I talk regularly to developers and architects about IaaS, PaaS, and SaaS. These terms, which are relatively new, can sometimes be confusing so I’d like to give a brief description of what they are and how they differ from each other.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/05/understanding-iaas-paas-saas_pic-01.jpg" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2020%2F05%2Funderstanding-iaas-paas-saas_pic-01-300x152.jpg" alt="Differences Between IaaS, PaaS, and SaaS: What they Stand For"&gt;&lt;/a&gt;As shown here, IaaS, PaaS, and SaaS stand for infrastructure, platform and software as a Service, respectively. The core idea behind ‘aaS’ is that you can focus on building products and services critical to your business and let other companies build and manage non-core services you need, whether as part of your own offering or just to run your business.&lt;/p&gt;

&lt;p&gt;These days, you can take pretty much add ‘aaS’ to anything, like “data” (DaaS) and “integration platform” which introduces the potentially confusing “iPaaS” which differs from both IaaS and PaaS! In the last few years, new businesses have popped up providing X, whether it be a product, application, feature or anything really, as a service to other businesses or consumers.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Overview: How did we get here?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Before we dive into what these 3 terms mean, let’s take a step back and look at how we got here. Life was simple when all developers had to worry about were monolithic applications running on-premises. As a company, you would either have your own datacenter or rent some space at a datacenter managed by another company. Your networking and sysadmin teams would make sure all the servers were properly connected and working for your developers to use. Your developers would build robust and scalable applications (hopefully) that got deployed to your servers. Simple, right?&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Infrastructure as a Service (IaaS)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Most mid-sized business and large enterprises, still manage their own servers and datacenters, but are adopting the cloud. For almost a decade most companies have realized they don’t want to be in the business of managing their own infrastructure (servers/datacenters) and would rather have someone else, such as Amazon or Google, do it for them. Startups these days are going straight to the cloud, which allows them to be extremely flexible and scalable amongst other things. This has led cloud providers such as AWS and GCP to provide you with servers and manage them for you – that’s infrastructure as a service!&lt;/p&gt;

&lt;p&gt;For example, you can easily &lt;a href="https://dev.to/himanshugupta/launching-an-ec2-instance-with-solace-s-pubsub-broker-2gg6-temp-slug-899625"&gt;spin up Solace PubSub+ Event Broker software on a linux server using an Amazon AMI&lt;/a&gt; in less than a minute. Compare this to having to buy a server, set it up, install it in a datacenter, and deploy software on it. Depending on the size of the company, this can take weeks, if not months.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Platform as a Service (PaaS)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;As companies started adopting IaaS and migrating to the cloud, it became apparent that it wasn’t so easy. A key benefit of the cloud is elasticity. It’s easy to spin up servers when demand is high and shut them down when demand is low, but, developing applications for your limited servers in your own datacenter is one thing. Developing applications to run in the cloud where your application might be deployed to hundreds of servers on peak days like Black Friday, accessible by way of the Internet or WAN links, might not be as stable as it is in your own private datacenter.&lt;/p&gt;

&lt;p&gt;All of this came with a lot of overhead for developers, and for DevOps team which now had to build and manage cloud-native applications. This led to platform as a service which lets developers develop cloud-native applications and manage the overhead associated with &lt;strong&gt;orchestrating them&lt;/strong&gt;. Popular PaaS offerings include AWS Elastic Beanstalk, Pivotal Cloud Foundry, Kubernetes and OpenShift. I recently blogged about &lt;a href="https://dev.to/solacedevs/deploying-a-single-solace-pubsub-event-broker-on-openshift-origin-5mi"&gt;how to deploy Solace’s broker in OpenShift&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Software as a Service (SaaS)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;As cloud migration has picked up, it has further fueled the build vs buy debate. Every company is faced with the option to either build something themselves and hence, have complete control over it or buy it from another company so they can focus on its core business at the cost of control. Additionally, while you might have the resources to build the product initially, you still have to dedicate significant resources to maintain and upgrade the product going forward. As a consequence, more and more companies are realizing that they would rather buy non-core products/software from other companies and focus on their core business. For example, you can use &lt;a href="http://www.solace.com/cloud" rel="noopener noreferrer"&gt;Solace Cloud&lt;/a&gt; to spin up a PubSub+ Event Broker without needing any hardware and have it managed by Solace.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;So what are the differences between IaaS, PaaS, and SaaS?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The main difference between IaaS, PaaS, and SaaS is how much they abstract away from end-users. The end product is an application that you want to use. For that to happen, you need to manage: datacenters, servers, networks, virtualization, operating systems, runtime, storage, middleware, data, applications, and monitoring.&lt;/p&gt;

&lt;p&gt;Here is a useful table which shows which parts are being abstracted away from the end-user in each model:&lt;a href="https://solace.com/wp-content/uploads/2020/05/understanding-iaas-paas-saas_pic-02.jpg" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2020%2F05%2Funderstanding-iaas-paas-saas_pic-02.jpg" alt="Table Showing Differences Between IaaS, PaaS, SaaS"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SaaS applications are completely managed by someone else. They can be easily accessed through a web browser, so you don’t need to worry about installing them on an on-prem server. They are provided as managed service which takes away the overhead of regularly upgrading the underlying software.&lt;/li&gt;
&lt;li&gt;PaaS provides you with everything you need to have your application running except for the actual application itself. You are responsible for writing the application and managing it but everything else, such as servers, runtime, and orchestration of your microservices, is provided.&lt;/li&gt;
&lt;li&gt;IaaS is the most basic (or flexible) of them all and only provides the underlying infrastructure, upon which you must set up your own runtime environments.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Picking the right model for your company&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/05/understanding-iaas-paas-saas_pic-03.jpg" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2020%2F05%2Funderstanding-iaas-paas-saas_pic-03-300x203.jpg" alt="Differences Between IaaS, PaaS, and SaaS: Picking is Stressful!"&gt;&lt;/a&gt;With so many options, it can be a little daunting to decide which one is the best for your company. Thankfully, you don’t have to pick just one. You can go with a hybrid model where your core applications will run on-prem in your own datacenter and the rest of your in-house applications will run on a PaaS such as OpenShift. You might also decide to have some database services run on cloud such as AWS Redshift. Finally, you might want to limit all your vendor software, such as HR/payroll management software (i.e. Workday), monitoring tools (i.e. New Relic), and event brokers (i.e. Solace), to SaaS.&lt;/p&gt;

&lt;p&gt;Picking the right model comes down to how much flexibility you want and how little you want to manage. If a product is core to your business and you need to heavily customize it, then going with a SaaS model is not the right option. However, there is no need to have your own convoluted HR/payroll management system when a generic SaaS solution would suffice. Finally, you have to consider the sensitivity of these applications and the data they manage. Some applications manage “crown jewel” processes and information that you won’t want to trust to a SaaS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;As you can see, there are a lot of similarities and differences between IaaS, PaaS, and SaaS. If you are a developer, you must be familiar with all three and how they differ. As an architect, you may be responsible for deciding which model, or hybrid approach, is right for your company based on your requirements, and resources. Fortunately, you can pick which model works best for you for each of your applications. I hope I’ve helped you understand a little bit better which one might be right for you.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://solace.com/blog/differences-between-iaas-paas-saas/" rel="noopener noreferrer"&gt;What are the Differences Between IaaS, PaaS, and SaaS?&lt;/a&gt; appeared first on &lt;a href="https://solace.com" rel="noopener noreferrer"&gt;Solace&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>paas</category>
      <category>saas</category>
      <category>iaas</category>
      <category>managedservice</category>
    </item>
    <item>
      <title>Configuring PubSub+ Event Broker for High Availability in AWS</title>
      <dc:creator>Himanshu Gupta</dc:creator>
      <pubDate>Thu, 12 Mar 2020 18:45:38 +0000</pubDate>
      <link>https://dev.to/solacedevs/configuring-pubsub-event-broker-for-high-availability-in-aws-1hc</link>
      <guid>https://dev.to/solacedevs/configuring-pubsub-event-broker-for-high-availability-in-aws-1hc</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2020%2F02%2Fpubsub-plus-ha-aws_featured-image.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2020%2F02%2Fpubsub-plus-ha-aws_featured-image.png"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;When architecting a system, it’s important to make sure it’s redundant, resilient, and fault-tolerant so it can carry on if a node fails, or even if all the nodes in one datacenter fail.&lt;/p&gt;

&lt;p&gt;PubSub+ Event Broker can be deployed in a high availability (HA) group, and configured for disaster recovery (DR). In this post, I’ll focus on deploying for HA in AWS. There is an &lt;a href="https://github.com/SolaceProducts/solace-aws-ha-quickstart" rel="noopener noreferrer"&gt;AWS CloudFormation template&lt;/a&gt; available for you to easily spin up your HA group, but I’d like to show you how to do it manually so you understand how it works.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;How does HA work with PubSub+ Event Broker?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A typical HA deployment of Solace’s PubSub+ Event Broker consists of three nodes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Primary&lt;/li&gt;
&lt;li&gt;Backup&lt;/li&gt;
&lt;li&gt;Monitor&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The primary and backup brokers are set up in active-standby configuration, while the third acts as a monitoring node. The two brokers have their own storage, so they share nothing and are completely independent. The monitoring node is just responsible for maintaining quorum between the primary and backup brokers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2020%2F02%2Fpubsub-plus-ha-aws.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2020%2F02%2Fpubsub-plus-ha-aws.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When a message is published to the primary broker, it is persisted locally and synchronously pushed to the backup broker. Once the backup broker receives the message, it acknowledges receipt to the primary broker, at which point the primary broker sends an acknowledgement back to the publisher.&lt;/p&gt;

&lt;p&gt;If there is a subscriber interested in this message, it will be forwarded to that subscriber. Otherwise, the message will be forwarded later. Once the subscriber receives the message, it will send a confirmation back to the primary broker. Upon receiving this receipt, the primary and standby brokers will both delete their copies of the message.&lt;/p&gt;

&lt;p&gt;Note that at any given time, only the active broker will accept connections. For example, let’s say your primary broker is your active broker. If and when the primary broker fails, the backup broker will become the active broker and start accepting connections. When the primary broker becomes available again, you can either configure your system to automatically make it the active broker again, or leave the secondary broker active. It’s recommended that you run the primary and secondary brokers on different servers within the same datacenter.&lt;/p&gt;

&lt;p&gt;This HA setup makes systems very resilient, because if the primary broker fails, the backup will quickly take over and minimize the impact to your system.&lt;/p&gt;

&lt;p&gt;Now that we know how an HA group works, let’s spin up three instances of PubSub+ Event Broker on AWS and configure them to be part of an HA group.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Launching EC3 instances with PubSub+ Event Broker&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Let’s see how we can configure three broker instances to be our primary broker, secondary broker, and monitoring node. We will be running three instances of PubSub+ Event Broker on three different EC2 instances on AWS. See my &lt;a href="https://dev.to/solacedevs/launching-an-amazon-ec2-instance-with-solace-pubsub-event-broker-4cgm"&gt;blog post&lt;/a&gt; on how to launch an EC2 instance with PubSub+Event Broker.&lt;/p&gt;

&lt;p&gt;Once you have an EC2 instance up and running, you should use the security group that was created for this instance and attach it to the backup and monitoring EC2 instance. Do not create all 3 instances with 3 different security groups.&lt;/p&gt;

&lt;p&gt;I also edited the security group that was created for the first EC2 instance to allow all incoming traffic from any instance that is attached to this security group. You can do this by going to the security group and under Inbound section, clicking  &lt;strong&gt;Edit&lt;/strong&gt; , then clicking  &lt;strong&gt;Add Rule&lt;/strong&gt; , selecting  &lt;strong&gt;All Traffic&lt;/strong&gt;  and in the  &lt;strong&gt;Source&lt;/strong&gt;  field, enter the security group Id. Here is what it should look like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/02/ha-aws_pic-2.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2020%2F02%2Fha-aws_pic-2.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Again, this is just for demo purposes to make sure all our instances can speak to each other.&lt;/p&gt;

&lt;h2&gt;
  
  
  Configuring HA group
&lt;/h2&gt;

&lt;p&gt;Now that we have all 3 EC2 instances with PubSub+ Event Broker up and running, we can begin to configure them as part of one HA group. The following steps have been thoroughly documented in the HA Group Configuration section of &lt;a href="https://docs.solace.com/Configuring-and-Managing/Configuring-HA-Groups.htm" rel="noopener noreferrer"&gt;Solace PubSub+ Technical Documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Before we begin, we need to update our router name on each instance. For an HA group to be configured, the router names  &lt;strong&gt;must&lt;/strong&gt;  match the node name. When we launched EC2 instance from Solace AMI, we were given a default router name (it’s usually the private IP address). We can use the given router name as our node name, but I would rather give our nodes more descriptive names such as &lt;code&gt;ha-demo-primary&lt;/code&gt;, &lt;code&gt;ha-demo-backup,&lt;/code&gt; and &lt;code&gt;ha-demo-monitor&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Primary node
&lt;/h3&gt;

&lt;p&gt;Log in to your primary node and change the router name to &lt;strong&gt;ha-demo-primary&lt;/strong&gt; :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/ Activate Solace CLI[sysadmin@ip-172-31-26-146 ~]$ solacectl cliSolace PubSub+ Standard Version 9.3.1.5Operating Mode: Message Routing Nodeip-172-31-26-146&amp;gt; enableip-172-31-26-146# configure/ Change router name to primaryip-172-31-26-146(configure)# router-name ha-demo-primaryThis command causes a reload of the system.Do you want to continue (y/n)? y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that a router name change requires a reboot of PubSub+ Event Broker so you will have to wait a minute or so before it comes back up. Run the following command once the broker has been rebooted to confirm the router name was changed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ip-172-31-26-146&amp;gt; show router-nameRouter Name:          ha-demo-primaryMirroring Hostname:   NoDeferred Router Name: ha-demo-primaryMirroring Hostname:   No
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you have updated the router name, you will need to run some commands to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create and designate different instances as  &lt;strong&gt;primary&lt;/strong&gt; ,  &lt;strong&gt;backup,&lt;/strong&gt; and  &lt;strong&gt;monitor&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Provide the authentication key&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;From Solace docs: &lt;code&gt;pre-shared-key&lt;/code&gt; is 44 to 344 characters (which translates into 32 to 256 bytes of binary data encoded in base 64). It’s used to provide authentication between nodes in a HA Group and must be the same on each node. I used &lt;a href="https://www.base64encode.net/" rel="noopener noreferrer"&gt;Base64 Encode&lt;/a&gt; to create my key. Once you have your key, run the following commands and replace my key with the one you created.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ip-172-31-26-146(configure)# hardware message-spool shutdownAll message spooling will be stopped.Do you want to continue (y/n)? yip-172-31-26-146(configure)# redundancyip-172-31-26-146(configure/redundancy)# switchover-mechanism hostlistip-172-31-26-146(configure/redundancy)# exitip-172-31-26-146(configure)# redundancyip-172-31-26-146(configure/redundancy)# groupip-172-31-26-146(configure/redundancy/group)# create node ha-demo-primaryip-172-31-26-146(configure/redundancy/group/node)# connect-via 172.31.26.146ip-172-31-26-146(configure/redundancy/group/node)# node-type message-routing-nodeip-172-31-26-146(configure/redundancy/group/node)# exitip-172-31-26-146(configure/redundancy/group)# create node ha-demo-backupip-172-31-26-146(configure/redundancy/group/node)# connect-via 172.31.26.208ip-172-31-26-146(configure/redundancy/group/node)# node-type message-routing-nodeip-172-31-26-146(configure/redundancy/group/node)# exitip-172-31-26-146(configure/redundancy/group)# create node ha-demo-monitorip-172-31-26-146(configure/redundancy/group/node)# connect-via 172.31.22.77ip-172-31-26-146(configure/redundancy/group/node)# node-type monitor-nodeip-172-31-26-146(configure/redundancy/group/node)# exitip-172-31-26-146(configure/redundancy/group)# exitip-172-31-26-146(configure/redundancy)# authenticationip-172-31-26-146(configure/redundancy/authentication)# pre-shared-key key c29sYWNlaXNhZ3JlYXRldmVudHBsYXRmb3Jtd2hpY2h5b3VzaG91bGR1c2Vmb3JhbGx5b3VyZXZlbnRpbmduZWVkcw==ip-172-31-26-146(configure/redundancy/authentication)# exitip-172-31-26-146(configure/redundancy)# active-standby-role primaryip-172-31-26-146(configure/redundancy)# no shutdown
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will mostly run the same commands on your backup node that you ran on your primary node. The only difference is that you will designate it as a backup node by running this command instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;active-standby-role backup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here are the commands you need to run on your backup node:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ip-172-31-26-208&amp;gt; enableip-172-31-26-208# configureip-172-31-26-208(configure)# router-name ha-demo-backupThis command causes a reload of the system.Do you want to continue (y/n)? yip-172-31-26-208(configure)# [sysadmin@ip-172-31-26-208 ~]$ solacectl cliSolace PubSub+ Standard Version 9.3.1.5Operating Mode: Message Routing Nodeip-172-31-26-208&amp;gt; show router-nameRouter Name:          ha-demo-backupMirroring Hostname:   NoDeferred Router Name: ha-demo-backupMirroring Hostname:   Noip-172-31-26-208&amp;gt; enableip-172-31-26-208# configureip-172-31-26-208(configure)# hardware message-spool shutdownAll message spooling will be stopped.Do you want to continue (y/n)? yip-172-31-26-208(configure)# redundancyip-172-31-26-208(configure/redundancy)# switchover-mechanism hostlistip-172-31-26-208(configure/redundancy)# groupip-172-31-26-208(configure/redundancy/group)# create node ha-demo-primaryip-172-31-26-208(configure/redundancy/group/node)# connect-via 172.31.26.146ip-172-31-26-208(configure/redundancy/group/node)# node-type message-routing-nodeip-172-31-26-208(configure/redundancy/group/node)# exitip-172-31-26-208(configure/redundancy/group)# create node ha-demo-backupip-172-31-26-208(configure/redundancy/group/node)# connect-via 172.31.26.208ip-172-31-26-208(configure/redundancy/group/node)# node-type message-routing-nodeip-172-31-26-208(configure/redundancy/group/node)# exitip-172-31-26-208(configure/redundancy/group)# create node ha-demo-monitorip-172-31-26-208(configure/redundancy/group/node)# connect-via 172.31.22.77ip-172-31-26-208(configure/redundancy/group/node)# node-type monitor-nodeip-172-31-26-208(configure/redundancy/group/node)# exitip-172-31-26-208(configure/redundancy/group)# exitip-172-31-26-208(configure/redundancy)# authenticationip-172-31-26-208(configure/redundancy/authentication)# pre-shared-key key c29sYWNlaXNhZ3JlYXRldmVudHBsYXRmb3Jtd2hpY2h5b3VzaG91bGR1c2Vmb3JhbGx5b3VyZXZlbnRpbmduZWVkcw==ip-172-31-26-208(configure/redundancy/authentication)# exitip-172-31-26-208(configure/redundancy)# active-standby-role backupip-172-31-26-208(configure/redundancy)# no shutdownip-172-31-26-208(configure/redundancy)#
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Monitor node
&lt;/h3&gt;

&lt;p&gt;The commands you need to run on your monitor node are slightly different but for the most part, you are doing the same sort of configuration that you did on primary and backup nodes.&lt;/p&gt;

&lt;p&gt;Before changing the router name on the monitor node, you need to run this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[sysadmin@ip-172-31-22-77 ~]$ solacectl cliSolace PubSub+ Standard Version 9.3.1.5Operating Mode: Message Routing Nodeip-172-31-22-77&amp;gt; enableip-172-31-22-77# reload default-config monitoring-nodeThis command causes a reload of the system which will discard all configurationand messaging data stored on this system.Do you want to continue (y/n)? y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will restart your node with default configs and designate it as a monitoring node (instead of a message routing node).&lt;/p&gt;

&lt;p&gt;Now, you can change the router name like we did with our primary and backup nodes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ip-172-31-22-77(configure)# router-name ha-demo-monitorThis command causes a reload of the system.Do you want to continue (y/n)? y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Confirm the name was changed by running this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ip-172-31-22-77# show router-nameRouter Name:          ha-demo-monitorMirroring Hostname:   NoDeferred Router Name: ha-demo-monitorMirroring Hostname:   No
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can now go ahead and run the following commands (just like you did with primary and backup nodes).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ip-172-31-22-77(configure)# redundancyip-172-31-22-77(configure/redundancy)# switchover-mechanism hostlistip-172-31-22-77(configure/redundancy)# groupip-172-31-22-77(configure/redundancy/group)# create node ha-demo-primaryip-172-31-22-77(configure/redundancy/group/node)# connect-via 172.31.26.146ip-172-31-22-77(configure/redundancy/group/node)# node-type message-routing-nodeip-172-31-22-77(configure/redundancy/group/node)# exitip-172-31-22-77(configure/redundancy/group)# create node ha-demo-backupip-172-31-22-77(configure/redundancy/group/node)# connect-via 172.31.26.208ip-172-31-22-77(configure/redundancy/group/node)# node-type message-routing-nodeip-172-31-22-77(configure/redundancy/group/node)# exitip-172-31-22-77(configure/redundancy/group)# create node ha-demo-monitorip-172-31-22-77(configure/redundancy/group/node)# connect-via 172.31.22.77ip-172-31-22-77(configure/redundancy/group/node)# node-type monitor-nodeip-172-31-22-77(configure/redundancy/group/node)# exitip-172-31-22-77(configure/redundancy/group)# exitip-172-31-22-77(configure/redundancy)# authenticationip-172-31-22-77(configure/redundancy/authentication)# pre-shared-key key c29sYWNlaXNhZ3JlYXRldmVudHBsYXRmb3Jtd2hpY2h5b3VzaG91bGR1c2Vmb3JhbGx5b3VyZXZlbnRpbmduZWVkcw==ip-172-31-22-77(configure/redundancy/authentication)# exitip-172-31-22-77(configure/redundancy)# no shutdown
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you are done configuring, you can run the following command on any of the nodes to confirm that all three nodes are Online and part of your HA group:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ip-172-31-26-146&amp;gt; show redundancy groupNode Router-Name   Node Type       Address           Status-----------------  --------------  ----------------  ---------ha-demo-backup     Message-Router  172.31.26.208     Onlineha-demo-monitor    Monitor         172.31.22.77      Onlineha-demo-primary\*   Message-Router  172.31.26.146     Online\* - indicates the current node
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s it! You now have a functional HA group with your primary and backup brokers and monitoring node.&lt;/p&gt;

&lt;p&gt;Note that by default, guaranteed messaging is disabled in HA group and can only be enabled once you have an HA group setup. It is recommended that you &lt;a href="https://docs.solace.com/Configuring-and-Managing/Configuring-HA-Groups.htm#Configur3" rel="noopener noreferrer"&gt;enable guaranteed messaging&lt;/a&gt; but for the purpose of this post, I will leave it as disabled.&lt;/p&gt;

&lt;h3&gt;
  
  
  More info on your HA group
&lt;/h3&gt;

&lt;p&gt;You can get more information about your redundancy settings by running this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ip-172-31-26-146&amp;gt; show redundancyConfiguration Status     : EnabledRedundancy Status        : UpOperating Mode           : Message Routing NodeSwitchover Mechanism     : HostlistAuto Revert              : NoRedundancy Mode          : Active/StandbyActive-Standby Role      : PrimaryMate Router Name         : ha-demo-backupADB Link To Mate         : UpADB Hello To Mate        : DownPrimary Virtual Router  Backup Virtual Router----------------------  ----------------------Activity Status                Local Active            ShutdownRouting Interface              intf0:1                 intf0:1Routing Interface Status       UpVRRP Status                    InitializeVRRP Priority                  250Message Spool Status           AD-DisabledPriority Reported By Mate      Standby
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can get even &lt;em&gt;more&lt;/em&gt; information by running this command: &lt;code&gt;show redundancy detail&lt;/code&gt; (I am not going to show the output here).&lt;/p&gt;

&lt;p&gt;I hope you found this post useful. For more information, visit &lt;a href="https://www.solace.dev/" rel="noopener noreferrer"&gt;PubSub+ for Developers&lt;/a&gt;. If you have any questions, post them to the &lt;a href="https://solace.community/" rel="noopener noreferrer"&gt;Solace Developer Community&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://solace.com/blog/pubsub-plus-high-availability-aws/" rel="noopener noreferrer"&gt;Configuring PubSub+ Event Broker for High Availability in AWS&lt;/a&gt; appeared first on &lt;a href="https://solace.com" rel="noopener noreferrer"&gt;Solace&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>fordevelopers</category>
    </item>
    <item>
      <title>Controlling an Arduino-based car with Solace PubSub+ Event Broker</title>
      <dc:creator>Himanshu Gupta</dc:creator>
      <pubDate>Mon, 09 Mar 2020 18:21:17 +0000</pubDate>
      <link>https://dev.to/solacedevs/controlling-an-arduino-based-car-with-solace-pubsub-event-broker-4f33</link>
      <guid>https://dev.to/solacedevs/controlling-an-arduino-based-car-with-solace-pubsub-event-broker-4f33</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LWQdcumJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/06/Icon-for-connected-vehicle-initiatives.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LWQdcumJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/06/Icon-for-connected-vehicle-initiatives.png" alt=""&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Let me start with a disclaimer that I am very new to Arduino. Despite having an Electrical Engineering degree, I had never really played around Arduino until very recently. The code referenced in this post was handed down to me by my colleagues at Solace.&lt;/p&gt;

&lt;p&gt;Recently, I presented for the first time at Solace’s meetup in New York. For this meetup, we decided to cover a specific feature of Solace PubSub+ which we thought our users and prospects would find interesting:  &lt;strong&gt;Replay&lt;/strong&gt;. &lt;a href="https://docs.solace.com/Overviews/Message-Replay-Overview.htm"&gt;PubSub+’s Replay&lt;/a&gt; feature is relatively new but extremely powerful and one that many users have welcomed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--idxw5yr3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/03/arduino-car-post_pic-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--idxw5yr3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/03/arduino-car-post_pic-1.png" alt="control Arduino car with pubsub+ event broker"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Every meetup’s success depends on two factors:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Food and drinks&lt;/li&gt;
&lt;li&gt;Demo&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Food and drinks were a no-brainer. We got a bunch of delicious pizza and lots of craft beer (lagers, pilsners, sours, and even &lt;em&gt;rosé&lt;/em&gt; cider!).&lt;/p&gt;

&lt;p&gt;However, having a cool demo for your meetup requires a lot of planning. We could have easily demoed Replay via PubSub+ admin UI. While it would have gotten the point across, it wouldn’t have been visually appealing. After a lot of discussions, we decided to use a car powered by Arduino and controlled by PubSub+. The idea was simple and visually appealing. We would build an Arduino-powered car and control it by sending MQTT messages via PubSub+. Then, we will replay those messages and show the car repeating its earlier steps (this is when the crowd goes “&lt;em&gt;oooh aaaah”).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In this post, I would like to show you how you can build your own Arduino-powered car and control it with &lt;a href="https://solace.com/products/event-broker/"&gt;PubSub+ Event Broker&lt;/a&gt;. Let’s get started.&lt;/p&gt;

&lt;p&gt;Here are the steps to achieve our goal:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Assemble car from the car kit&lt;/li&gt;
&lt;li&gt;Configure code and upload to Arduino chip&lt;/li&gt;
&lt;li&gt;Send messages to control the car&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Assemble Car from the Car Kit&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;** ** I don’t want to document all the steps I followed to assemble the car because, to be honest, I was just following instructions from other blogs. The instructions that came with the kit were not very helpful and very difficult to understand.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iwphkwLW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/03/arduino-car-post_pic-2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iwphkwLW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/03/arduino-car-post_pic-2.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can buy the kit from &lt;a href="https://amzn.to/2ur9WMd"&gt;Amazon&lt;/a&gt;. More details about the kit can be found on &lt;a href="https://www.sinoning.com/collections/assembly-car-kit/products/2wd-l293d-wifi-rc-smart-car-with-nodemcu-shield-for-esp-12e-based-on-esp8266-mobile-control"&gt;this site&lt;/a&gt;. This &lt;a href="https://www.youtube.com/watch?time_continue=4&amp;amp;v=sEjhM3cMlhc&amp;amp;feature=emb_logo"&gt;YouTube video&lt;/a&gt; was very helpful and I highly recommend using it as a starting point.&lt;/p&gt;

&lt;p&gt;The assembled car should look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jWrZ5cOZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/03/arduino-car-post_pic-3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jWrZ5cOZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/03/arduino-car-post_pic-3.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Configuring Code and Uploading to Arduino Chip
&lt;/h2&gt;

&lt;p&gt;Once you have the car assembled, it is time to upload code to the Arduino chip. You can find the code on Solace’s &lt;a href="https://github.com/solacese/car-demo"&gt;github&lt;/a&gt;. In the repo, you will find &lt;code&gt;car_demo/arduino/src/car_kit.ino&lt;/code&gt; which is the code that you will need to open using Arduino IDE and upload it to chip. Note that the following instructions are meant for the ESP8266 chip only.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Hv3V0cM6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/03/arduino-car-post_pic-4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Hv3V0cM6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/03/arduino-car-post_pic-4.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Downloading Arduino IDE&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;To be able to upload code to the chip, you will need to &lt;a href="https://www.arduino.cc/en/main/software"&gt;download&lt;/a&gt; and use the Arduino IDE. I recommend downloading the software instead of just using the browser version. Once installed, open &lt;code&gt;car_kit.ino&lt;/code&gt; in the Arduino IDE.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Configuring code&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Before you can upload the code, you need to modify the code slightly to get it to work for you. You need to make a minimum of two changes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enter wifi details so the chip can connect to the Internet&lt;/li&gt;
&lt;li&gt;Enter MQTT broker details&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Modify the following lines by entering your Wifi details:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const char\* ssid = "&amp;lt;ssid&amp;gt;";const char\* password =  "&amp;lt;ssid\_pwd&amp;gt;";
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Modify the following lines by entering your MQTT broker details:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const char\* mqttServer = "";const int mqttPort = ;const char\* mqttUser = "";const char\* mqttPassword = "";
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You will need an MQTT broker running so you can enter the relevant connection settings. Of course, I would recommend using Solace’s PubSub+ Event Broker which supports MQTT. You can spin up an instance via &lt;a href="https://solace.com/products/event-broker/cloud/"&gt;Solace Cloud&lt;/a&gt; for free.&lt;/p&gt;

&lt;h3&gt;
  
  
  Configuring board
&lt;/h3&gt;

&lt;p&gt;Before uploading this code to your Arduino chip, you will need to configure your IDE to work with the specific model of your chip as well as install &lt;code&gt;PubSubClient&lt;/code&gt; and &lt;code&gt;ArduinoJson&lt;/code&gt; libraries.&lt;/p&gt;

&lt;p&gt;Arduino IDE supports a lot of ‘boards’/chips out-of-box but sadly, doesn’t support the ESP8266 chip. So, we need to add it manually to Arduino’s Board Manager. To do so, go to  &lt;strong&gt;Arduino&lt;/strong&gt;  &amp;gt;  &lt;strong&gt;Preferences&lt;/strong&gt; and enter the URL: &lt;a href="http://arduino.esp8266.com/stable/package%5C_esp8266com%5C_index.json"&gt;http://arduino.esp8266.com/stable/package\_esp8266com\_index.json&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sdKN9vt1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/03/arduino-car-post_pic-4.5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sdKN9vt1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/03/arduino-car-post_pic-4.5.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click &lt;strong&gt;OK&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Now, go to &lt;strong&gt;Tools &amp;gt; Boards &amp;gt; Boards Manager&lt;/strong&gt; , and search for ESP8266. You will now see ESP8266 board by ESP8266 Community. Click on Install to install it. You can also choose to install a specific version if needed. We are using 2.6.3 currently.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ANhdsHQX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/03/arduino-car-post_pic-4.6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ANhdsHQX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/03/arduino-car-post_pic-4.6.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Installing necessary libraries&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Now, you are ready to install &lt;code&gt;PubSubClient&lt;/code&gt; and &lt;code&gt;ArduinoJson&lt;/code&gt; libraries. You can easily do that by going to  &lt;strong&gt;Tools&lt;/strong&gt;  &amp;gt;  &lt;strong&gt;Manage Libraries&lt;/strong&gt;  and simply searching for them and installing them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HoLB8FDe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/03/arduino-car-post_pic-5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HoLB8FDe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/03/arduino-car-post_pic-5.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you have these libraries installed, you are ready to upload the code to the Arduino chip. Plug your chip into your computer via Micro USB cable. You will see a blue LED light as soon as you plug in the chip. If you don’t see the light, try toggling the white switch on the chip to turn it on.&lt;/p&gt;

&lt;p&gt;Finally, go to  &lt;strong&gt;Sketch&lt;/strong&gt;  &amp;gt;  &lt;strong&gt;Upload&lt;/strong&gt;  to upload the code to your chip.&lt;/p&gt;

&lt;p&gt;That’s it!&lt;/p&gt;

&lt;h2&gt;
  
  
  Sending MQTT messages via PubSub+
&lt;/h2&gt;

&lt;p&gt;You can now go to PubSub+ UI and send some sample messages to your chip to control the car.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Getting the Chip ID&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;If you are using the exact code from &lt;code&gt;car_kit.ino&lt;/code&gt;, you will need to publish messages to &lt;code&gt;car/drive/${chipID}&lt;/code&gt; topic where &lt;code&gt;chipID&lt;/code&gt; is your Chip’s ID. You can get the Chip ID by looking at the output of your code in the Serial Monitor. To be able to run the Serial Monitor from Arduino, you will need to make sure your chip is plugged in via USB to your laptop. When you upload the code, you can run the Serial Monitor to see the output.&lt;/p&gt;

&lt;p&gt;Here is the output of my Serial Monitor:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RLc4XKP6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/03/arduino-car-post_pic-6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RLc4XKP6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/03/arduino-car-post_pic-6.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As shown in the screenshot above, my Chip ID is 6994174.&lt;/p&gt;

&lt;p&gt;Here is some good &lt;a href="https://www.instructables.com/id/HOW-TO-use-the-ARDUINO-SERIAL-MONITOR/"&gt;documentation&lt;/a&gt; on how to use Arduino’s Serial Monitor.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Sending MQTT Messages&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The payload of your message should be in JSON format and should include three values:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;l – power for the left motor with a range of -100 to 100&lt;/li&gt;
&lt;li&gt;r – power for the right motor with a range of -100 to 100&lt;/li&gt;
&lt;li&gt;d – duration in milliseconds&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Negative power will make the motor turn in the opposite direction compared to positive power. For example, l:100, r:100 and d:500 will make the car move forward for 500 milliseconds. If you want to turn right, you can set l to 0 and if you want to turn left, you can set r to 0, respectively. You can control how far the car drives by adjusting the duration (d) parameter.&lt;/p&gt;

&lt;p&gt;Here is a sample payload:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{"l": 100,"r": 100,"d": 700}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YZoQTTHd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/03/arduino-car-post_pic-7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YZoQTTHd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/03/arduino-car-post_pic-7.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Solace PubSub+ Try Me! Publisher&lt;/p&gt;

&lt;p&gt;It’s up to you how you would like to publish these JSON messages. For development, you can simply use Solace’s &lt;em&gt;Try Me!&lt;/em&gt; tab and use the Publisher app there to publish these messages.&lt;/p&gt;

&lt;p&gt;Of course, you can build a nice shiny app or program a joystick to send such messages. It’s up to you how creative you want to get!&lt;/p&gt;

&lt;h2&gt;
  
  
  Architecture
&lt;/h2&gt;

&lt;p&gt;Now that we have our car running, let’s take a step back and look at the architecture of our setup:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wrpv8-8y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/03/arduino-car-post_pic-8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wrpv8-8y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/03/arduino-car-post_pic-8.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the left side, we have our assembled car powered by an Arduino chip and subscribing to an MQTT topic with QoS 1. You can see where we specify the subscription in the code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Subscribe to car specific drive commands char carDriveTopic[40]; sprintf(carDriveTopic, "car/drive/%lu", chipId); client.subscribe(carDriveTopic, 1);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;As you can see, we are subscribing to &lt;code&gt;car/drive/${chipId}&lt;/code&gt; with QoS of 1. Specifying QoS to be 1 causes PubSub+ to create an internal queue and map car/drive/${chipId} topic to the queue. When we publish JSON messages to the &lt;code&gt;car/drive/${chipId}&lt;/code&gt; topic, our messages are sent to the queue and then to the Arduino chip.&lt;/p&gt;

&lt;p&gt;On the right side, we have our Controller UI which is simply the javascript Publisher app on &lt;em&gt;Try Me!&lt;/em&gt; tab on Solace Cloud.&lt;/p&gt;

&lt;p&gt;Needless to say, the MQTT broker being used here is Solace’s PubSub+ Event Broker running on AWS.&lt;/p&gt;

&lt;p&gt;That’s pretty much it! I hope you found this post useful. For more information, visit &lt;a href="https://www.solace.dev/"&gt;&lt;strong&gt;PubSub+ for Developers&lt;/strong&gt;&lt;/a&gt;. If you have any questions, post them to the &lt;a href="https://solace.community/"&gt;&lt;strong&gt;Solace Developer Community&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://solace.com/blog/arduino-car-solace-replay/"&gt;Controlling an Arduino-based car with Solace PubSub+ Event Broker&lt;/a&gt; appeared first on &lt;a href="https://solace.com"&gt;Solace&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>fordevelopers</category>
      <category>mqtt</category>
      <category>eventbroker</category>
      <category>solace</category>
    </item>
    <item>
      <title>Launching an Amazon EC2 instance with Solace PubSub+ Event Broker</title>
      <dc:creator>Himanshu Gupta</dc:creator>
      <pubDate>Tue, 04 Feb 2020 02:35:15 +0000</pubDate>
      <link>https://dev.to/solacedevs/launching-an-amazon-ec2-instance-with-solace-pubsub-event-broker-4cgm</link>
      <guid>https://dev.to/solacedevs/launching-an-amazon-ec2-instance-with-solace-pubsub-event-broker-4cgm</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2019%2F08%2Fsolace-default-blog-thumbnail-600x285.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2019%2F08%2Fsolace-default-blog-thumbnail-600x285.jpg" alt="Further thoughts on FPGA co-processing and performance"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this post, I would like to show you how you can quickly spin up an Amazon EC2 instance with the &lt;a href="https://solace.com/products/event-broker/" rel="noopener noreferrer"&gt;Solace PubSub+ Event Broker&lt;/a&gt; deployed on it. Of course, you can always just use &lt;a href="https://solace.com/products/event-broker/cloud/" rel="noopener noreferrer"&gt;Solace Cloud&lt;/a&gt; and deploy on AWS through it in seconds but where is the fun in that?&lt;/p&gt;

&lt;p&gt;I love AMIs and I cannot lie. Gone are the days when you had to read lengthy documentation and figure out how to manually install binaries. Gone are the days when you had to worry about installing different package managers to manually install all the required libraries via &lt;code&gt;pip&lt;/code&gt; or &lt;code&gt;conda&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We live in a brave new world where with just few clicks, we can spin up an Amazon EC2 instance with all the necessary binaries and libraries installed with proper configurations to quickly get started. Personally, as a developer who loves to try new technologies and who does a lot of demos, this is so convenient.&lt;/p&gt;

&lt;p&gt;Solace PubSub+ Event Broker is “unified event broker technology available as run-anywhere software, purpose-built hardware, and a managed service that you can use together to stream events across your distributed enterprise”. PubSub+ &lt;a href="https://solace.com/downloads/" rel="noopener noreferrer"&gt;Standard Edition&lt;/a&gt; is free to use, even in production.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Amazon Machine Image (AMI)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Amazon has AMI Marketplace where you can pick from numerous paid and free AMIs. In case you are not familiar with AMIs, they provide the information required to launch an EC2 instance; Solace also has an &lt;a href="https://aws.amazon.com/marketplace/pp/Solace-Corporation-Solace-PubSub-Software-Message-/B077GRGL8Q" rel="noopener noreferrer"&gt;AMI&lt;/a&gt; available for PubSub+Event Broker: Software.&lt;/p&gt;

&lt;p&gt;You will find necessary information on the AMI page about the instance and what it contains. In my opinion, the most important section is the &lt;strong&gt;Pricing Information&lt;/strong&gt; section which tells you the estimated cost of launching an instance from this AMI.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/01/ec2-blog_pic-1.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2020%2F01%2Fec2-blog_pic-1.png" alt="Pricing Information"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, there is no cost to using the PubSub+ Event Broker: Software itself but there is cost involved for the underlying AWS infrastructure since you can’t use the free tier Amazon EC2 instance to run Solace PubSub+ Event Broker. Keep this in mind as you launch your own EC2 instance.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Usage Information&lt;/strong&gt; section is also very helpful. You can find links to several necessary resources there which help you get started.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/01/ec2-blog_pic-2.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2020%2F01%2Fec2-blog_pic-2.png" alt="Usage Information"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Alright, let’s go ahead and launch an EC2 instance from the AMI. You can do it straight from the current page or you can go to the EC2 page and launch an instance from there. We will do it from the EC2 page.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Launching an Amazon EC2 instance from Solace PubSub+ Event Broker: Software AMI&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Log in to your AWS account and go to the EC2 services page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/01/ec2-blog_pic-3.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2020%2F01%2Fec2-blog_pic-3.png" alt="Log in to your AWS account"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you are there, click the &lt;strong&gt;Launch instance&lt;/strong&gt; button and select &lt;strong&gt;Launch instance&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/01/ec2-blog_pic-4.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2020%2F01%2Fec2-blog_pic-4.png" alt="Launch instance"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Great, you will now be taken to a page where you can pick an AMI from which you will launch your EC2 instance.&lt;/p&gt;

&lt;p&gt;Click the &lt;strong&gt;AWS Marketplace&lt;/strong&gt; tab and search for &lt;strong&gt;Solace&lt;/strong&gt;. You will see Solace’s PubSub+ AMI as the result of your query. Click &lt;strong&gt;Select&lt;/strong&gt; to proceed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/01/ec2-blog_pic-5.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2020%2F01%2Fec2-blog_pic-5.png" alt="Click the AWS Marketplace tab and search for Solace"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the next page, you will see the pricing and usage information which we saw earlier. Click &lt;strong&gt;Continue&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Then, you will be asked to pick the underlying EC2 instance. There are minimum requirements to use PubSub+ Event Broker software so you cannot use &lt;strong&gt;t2.micro&lt;/strong&gt; (free tier). The recommended instance is General Purpose t2.large (2 vCPUs, 8 GiB Memory) so we will stick to that for this demo. Note that different instances cost differently, so pick wisely.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/01/ec2-blog_pic-6.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2020%2F01%2Fec2-blog_pic-6.png" alt="use PubSub+ Event Broker software"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click &lt;strong&gt;Configure Instance Details&lt;/strong&gt;. On this page, you can select which VPC you would like to deploy your instance into and pick IAM role to attach to the instance among other details. For our purpose, we will stick with the defaults. The only thing I changed is that I assigned my existing admin IAM role to my EC2 instance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/01/ec2-blog_pic-7.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2020%2F01%2Fec2-blog_pic-7.png" alt="Configure Instance Details"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click &lt;strong&gt;Add Storage&lt;/strong&gt; and leave it as it is and click &lt;strong&gt;Add Tags&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This is not mandatory but I like to add tags to my EC2 instances so I can easily recognize them later. I added the ‘Name’ tag to my EC2 instance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/01/ec2-blog_pic-8.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2020%2F01%2Fec2-blog_pic-8.png" alt="I added the Name tag to my EC2 instance"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click &lt;strong&gt;Configure Security Group&lt;/strong&gt; to configure your security settings. The default option is to create a new Security Group with the recommended rules, or you can pick an existing Security Group. For our use case, we will create a new group with the recommended settings. Click &lt;strong&gt;Review and Launch&lt;/strong&gt;. Review the details and click Launch. You will be asked to select an existing Key Pair or create a new one. I have selected an existing Key Pair which I will be using to log in to this EC2 instance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/01/ec2-blog_pic-9.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2020%2F01%2Fec2-blog_pic-9.png" alt="Configure Security Group"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And, that’s it! We now have an EC2 instance spinning up from Solace’s PubSub+ Event Broker software AMI.&lt;/p&gt;

&lt;p&gt;Next, we will take PubSub+ Event Broker for a spin.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Configuring PubSub+ Event Broker&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;There is not much to configure, which is the beauty of this whole setup, except for an admin user which we will use to later log in to PubSub+ Manager.&lt;/p&gt;

&lt;p&gt;First, let’s log in to our EC2 instance using the Key Pair which we selected when we launched our EC2 instance.&lt;/p&gt;

&lt;p&gt;Go to your EC2 page and you should see your new EC2 instance there:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/01/ec2-blog_pic-10.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2020%2F01%2Fec2-blog_pic-10.png" alt=" EC2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select your EC2 instance and click &lt;strong&gt;Connect&lt;/strong&gt; to get the ssh command. Note that you need to use the &lt;strong&gt;sysadmin&lt;/strong&gt; user instead of &lt;strong&gt;root&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MacBook-Pro:Downloads hgupta$ ssh -i "himanshu-tokyo.pem" sysadmin@ec2-13-115-6-241.ap-northeast-1.compute.amazonaws.comSolace PubSub+ Standard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can now see the Solace PubSub+ Event Broker instance running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[sysadmin@ip-172-31-28-133 ~]$ solacectl cliSolace PubSub+ Standard Version 9.3.1.5Operating Mode: Message Routing Node
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This proves that we were able to successfully launch an Amazon EC2 instance with Solace PubSub+ Event Broker on it. We now need to create an admin user which we will use to log in to Solace PubSub+ Manager. We can do so through Solace CLI.&lt;/p&gt;

&lt;p&gt;First, let’s activate the CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[sysadmin@ip-172-31-28-133 ~]$ solacectl cliSolace PubSub+ Standard Version 9.3.1.5Operating Mode: Message Routing Node
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we can run the following commands to create a new user called &lt;strong&gt;admin&lt;/strong&gt; with the password &lt;strong&gt;admin&lt;/strong&gt; (obviously, don’t do it in production).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ip-172-31-28-133&amp;amp;amp;amp;gt; enableip-172-31-28-133# configureip-172-31-28-133(configure)# create username admin password admin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That should do it.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Accessing PubSub+ Manager&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Now that we have our &lt;strong&gt;admin&lt;/strong&gt; user created, we can use its credentials to log in to PubSub+ Manager.&lt;/p&gt;

&lt;p&gt;Go to the following URL on your browser: &lt;strong&gt;http://:8080&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You will see the Solace PubSub+Event Broker Software Standard login page:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/01/ec2-blog_pic-11.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2020%2F01%2Fec2-blog_pic-11.png" alt="Solace PubSub+Event Broker Software Standard login page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Log in with your &lt;strong&gt;admin&lt;/strong&gt; credentials and you will be taken to the following page with your &lt;strong&gt;default&lt;/strong&gt; Message VPN:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/01/ec2-blog_pic-12.png" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsolace.com%2Fwp-content%2Fuploads%2F2020%2F01%2Fec2-blog_pic-12.png" alt="default Message VPN:"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that’s it! This whole process took me 5-10 minutes.&lt;/p&gt;

&lt;p&gt;Once you are done playing around with PubSub+Event Broker, you can easily terminate your EC2 instance from your EC2 instance page. Make sure to do so to avoid any infrastructure charges.&lt;/p&gt;

&lt;p&gt;I hope you found this post useful. For more information, visit &lt;a href="https://www.solace.dev/" rel="noopener noreferrer"&gt;PubSub+ for Developers&lt;/a&gt;. If you have any questions, post them to the &lt;a href="https://solace.community/" rel="noopener noreferrer"&gt;Solace Developer Community&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://solace.com/blog/amazon-ec2-pubsub-plus/" rel="noopener noreferrer"&gt;Launching an Amazon EC2 instance with Solace PubSub+ Event Broker&lt;/a&gt; appeared first on &lt;a href="https://solace.com" rel="noopener noreferrer"&gt;Solace&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>solace</category>
      <category>aws</category>
    </item>
  </channel>
</rss>
