<?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: Thomas K</title>
    <description>The latest articles on DEV Community by Thomas K (@tkthetechie).</description>
    <link>https://dev.to/tkthetechie</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%2F327365%2F245c3113-96e1-4b4f-843a-7b520ad7837b.png</url>
      <title>DEV Community: Thomas K</title>
      <link>https://dev.to/tkthetechie</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tkthetechie"/>
    <language>en</language>
    <item>
      <title>Using GraphQL to Query the State of Your Event Mesh</title>
      <dc:creator>Thomas K</dc:creator>
      <pubDate>Tue, 16 Feb 2021 15:16:59 +0000</pubDate>
      <link>https://dev.to/solacedevs/using-graphql-to-query-the-state-of-your-event-mesh-4j6g</link>
      <guid>https://dev.to/solacedevs/using-graphql-to-query-the-state-of-your-event-mesh-4j6g</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0pzcUya7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/03/DARK_Service-Mesh-Meet-Event-Mesh-.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0pzcUya7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/03/DARK_Service-Mesh-Meet-Event-Mesh-.png" alt="" width="880" height="418"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;In this blog post, I will explain how you can leverage the power of GraphQL’s extensible API model to better understand the architecture and state of your event mesh. An &lt;a href="https://solace.com/what-is-an-event-mesh/"&gt;event mesh&lt;/a&gt; is an interconnected network of event brokers that distributes events among decoupled applications, cloud services and devices, anywhere in the world and running in any cloud, edge or on-premises environment.&lt;/p&gt;

&lt;p&gt;Here’s the high-level architecture of an event mesh:&lt;br&gt;&lt;br&gt;
&lt;a href="https://solace.com/wp-content/uploads/2021/02/graphql-post-pic-01.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qoSryNXd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/02/graphql-post-pic-01.png" alt="" width="880" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this diagram, you have a network of &lt;a href="https://solace.com/products/event-broker/"&gt;Solace PubSub+ Event Brokers&lt;/a&gt; deployed on-prem, in public clouds, and even in a private cloud. They link together via a protocol called dynamic message routing (&lt;a href="https://docs.solace.com/Overviews/DMR-Overview.htm"&gt;DMR&lt;/a&gt;). The key thing  to understand about DMR is that events will only get routed to where they need to go without the need to pre-define the path or the routing rules.&lt;/p&gt;

&lt;p&gt;For example, if you have an &lt;a href="https://beam.apache.org/"&gt;Apache Beam&lt;/a&gt;[Google Cloud Dataflow](&lt;a href="https://cloud.google.com/dataflow"&gt;https://cloud.google.com/dataflow&lt;/a&gt;) microservice producing an event in&lt;a href="https://cloud.google.com"&gt;Google Cloud Platform&lt;/a&gt; and you want it to be routed to a microservice in AWS, all the microservice in AWS has to do is express interest in the Beam\Dataflow event via a ‘&lt;a href="https://docs.solace.com/PubSub-Basics/Understanding-Topics.htm"&gt;Topic Subscription&lt;/a&gt;’.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;REST-ful API to manage/monitor PubSub+ Event Broker&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A core component of the event mesh is the event broker. Solace’s PubSub+ Event Broker is a &lt;a href="https://solace.com/products/apis-protocols/"&gt;multi-protocol&lt;/a&gt; event broker that comes in multiple form factors – &lt;a href="https://solace.com/products/event-broker/appliance/"&gt;hardware appliances&lt;/a&gt;, &lt;a href="https://solace.com/products/event-broker/software/"&gt;software&lt;/a&gt;, and &lt;a href="https://solace.com/products/event-broker/cloud/"&gt;as a service&lt;/a&gt;. The event broker handles client connectivity to the event mesh and also routes data to the neighboring nodes in the event mesh.&lt;/p&gt;

&lt;p&gt;Every PubSub+ Event Broker exposes a REST-ful management interface – called the Solace Element Management Protocol (&lt;a href="https://docs.solace.com/SEMP/Using-SEMP.htm"&gt;SEMP&lt;/a&gt;) – that  gives you access to various internal statistics and administrative functions for the event broker.&lt;/p&gt;

&lt;p&gt;For example, by running a SEMP query against a broker, you can figure out which IP-Addresses/users are connected to the broker. Another query will give you an understanding of which Topic Subscriptions are active on a broker.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;GraphQL as an Abstraction Layer on Your Event Mesh&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Solace has monitoring solutions, such as  Solace PubSub+ Monitor and PubSub+ Insights built on top of the SEMP API and along with gathering logs, but we will be using GraphQL to extend the SEMP API.&lt;/p&gt;

&lt;p&gt;By taking advantage of the SEMP API, you can periodically poll all the nodes of your event mesh to store statistics in a database. You can then use a GraphQL server to front the results of the database and can build out an expressive API that will allow you to answer questions such as :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which node has a subscription active on a specified topic?&lt;/li&gt;
&lt;li&gt;Which user(s) is subscribing to a specific topic?&lt;/li&gt;
&lt;li&gt;Which links of my event mesh are experiencing the most traffic?&lt;/li&gt;
&lt;li&gt;Which topics are being most subscribed to across the event mesh?&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;A Sample Implementation&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;I’ve written a basic Node application that queries nodes of the event mesh and store it in a database using &lt;a href="https://prisma.io"&gt;Prisma&lt;/a&gt; – a powerful JavaScript ORM library. I also wrote a GraphQL server that exposes the tables in Prisma via GraphQL. The utility currently stores and exposes client and topic subscriptions but can easily be extended to cover more use cases.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Sr1VDEyY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/02/graphql-post-pic-02.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Sr1VDEyY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2021/02/graphql-post-pic-02.png" alt="" width="880" height="541"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can find the GitHub repo/setup instructions &lt;a href="https://github.com/solacese/event-mesh-graphql"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here are some sample queries and the results that you can get with this application stack:&lt;/p&gt;
&lt;h3&gt;
  
  
  Which node is my topic subscribed to from?
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
query{
findClientsForSubscription(topicString: "my/topic")
{
   subscription
   clients {
     nodeName
   }
}
}

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

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Result:&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;
{"data": {
  "findClientsForSubscription": [
  {
    "subscription": "my/topic",
    "clients": [
     {
       "nodeName": "Cloud Broker"
     },
     {
       "nodeName": "Local Broker"
     }
    ]
   }
  ]
 }
}

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Which user and node is my topic subscribed to from?
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
Query{
findClientsForSubscription(topicString: "my/topic"){
  subscription
  clients {
    nodeName
    userName
  }
}
}

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Response:&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;
{"data": {
  "findClientsForSubscription": [
    {
      "subscription": "my/topic",
      "clients": [
        {
          "nodeName": "Cloud Broker",
          "userName": "local-user"
        },
        {
          "nodeName": "Local Broker",
          "userName": "default"
        }
      ]
    }
  ]
}
}

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

&lt;/div&gt;



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

&lt;p&gt;An event mesh is a powerful platform that dynamically routes events to their intended destination and nowhere else. GraphQL is a very powerful query language that is able to help you find answers to specific questions about your event mesh.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://solace.com/blog/graphql-to-query-event-mesh/"&gt;Using GraphQL to Query the State of Your Event Mesh&lt;/a&gt; appeared first on &lt;a href="https://solace.com"&gt;Solace&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>graphql</category>
      <category>developers</category>
      <category>eventdriven</category>
      <category>metrics</category>
    </item>
    <item>
      <title>A scalable WebSocket fanout solution for your High Performance Kafka deployment</title>
      <dc:creator>Thomas K</dc:creator>
      <pubDate>Tue, 02 Feb 2021 20:52:24 +0000</pubDate>
      <link>https://dev.to/tkthetechie/a-scalable-websocket-fanout-solution-for-your-high-performance-kafka-deployment-4abe</link>
      <guid>https://dev.to/tkthetechie/a-scalable-websocket-fanout-solution-for-your-high-performance-kafka-deployment-4abe</guid>
      <description>&lt;p&gt;In this post, I will show how you can take advantage of a high performance Kafka deployment, the Kafka Connect framework and Solace PubSub+ to build out a scalable websocket distribution backbone for a contrived market data distribution use case.&lt;/p&gt;

&lt;h3&gt;
  
  
  Market data distribution
&lt;/h3&gt;

&lt;p&gt;For the purpose of this article, I'll be focusing on a financial service use case- specifically market data distribution. Typically market data will be streamed over an exchange using a proprietary protocol. For your internal microservices or UIs, you would consume/normalize/and republish over an event broker of your choosing such as &lt;a href="https://kafka.apache.org/" rel="noopener noreferrer"&gt;Apache Kafka&lt;/a&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  Fanning out to thin clients via WebSocket
&lt;/h3&gt;

&lt;p&gt;For a lot of messaging use-cases, one of the end-points you would likely need to stream to is a web browser. Kafka doesn't support the WebSocket protocol that you could use with your HTML5/JS applications. To bridge from Kafka to WebSocket, we will need to introduce two new components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://solace.com/try-it-now/" rel="noopener noreferrer"&gt;Solace PubSub+ Event Broker&lt;/a&gt; - A multiprotocol event broker that is able to publish and subscribe natively through a variety of protocols such as JMS, AMQP, MQTT, Solace WebSocket, and REST.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/SolaceProducts/pubsubplus-connector-kafka-sink" rel="noopener noreferrer"&gt;Solace PubSub+ Kafka Sink Connector&lt;/a&gt; - This will bridge from Kafka event streams into Solace.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Filtering messages to a thin-client
&lt;/h3&gt;

&lt;p&gt;A Kafka Topic is a contiguous stream of messages organized via a partition. A sample topic-partition may consist of 1000's of streams streams of data with the following structure on a Topic&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Topic: PRICES
Partition: 1
Offset 0:
{"tickerSymbol":"AAPL","countryCode":"US","exchange":"NASDAQ","bidSize":10.0,"askSize":10.0,"bidPrice":100.0,"askPrice":105.0}
Offset 1:
{"tickerSymbol":"GME","countryCode":"US","exchange":"NYSE","bidSize":10.0,"askSize":10.0,"bidPrice":1000.0,"askPrice":995.0}
Offset 3:
{"tickerSymbol":"MSFT","countryCode":"US","exchange":"NASDAQ","bidSize":10.0,"askSize":10.0,"bidPrice":142.0,"askPrice":143.0}
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, it's likely that a user would only want to subscribe to a subset of the streams rather than the entire topic/topic partition... usually via an identifer like a ticker symbol. &lt;/p&gt;

&lt;p&gt;As such, a finer level of topic filtering will be required which can be accomodated via the subscription semantics of a protocol like MQTT.&lt;/p&gt;

&lt;p&gt;For example, a user may only be interested in the AAPL stock, so they can issue a subscription to Solace PubSub+ with the following semantics:&lt;br&gt;
&lt;code&gt;US/NASDAQ/AAPL&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Or if they wanted to subscribe to all US stocks, they can issue a subscription with the following semantics:&lt;br&gt;
&lt;code&gt;US/NASDAQ/#&lt;/code&gt;&lt;br&gt;
which will deliver all messages from the NASDAQ market to the client. &lt;/p&gt;

&lt;p&gt;This finer grained topic filtering is not something that Kafka provides out of the box. Hence the Kafka Connector would have some simple logic to translate the contents of the payload into a topic to be passed onto Solace. A simplistic implementation of this function would be as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; private class SolMarketDataObject {
        public String tickerSymbol;
        public String countryCode;
        public String exchange;
        public double bidSize;
        public double askSize;
        public double bidPrice;
        public double askPrice;

        public String createSolaceTopic() {
            return countryCode + "/" + exchange + "/" + tickerSymbol;
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In addition, the Solace PubSub+ Broker will guarantee order of the streams to the HTML5 front end in the order it was received from the Kafka cluster without having to create any sorts of topics or partitions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Putting it all together
&lt;/h3&gt;

&lt;p&gt;MarketData distribution usescases typically have high performance requirements. While Apache Kafka has a variety of knobs that you can tune to achieve low latency and high throughput, it usually comes at a cost of an increased probability of message loss.&lt;/p&gt;

&lt;p&gt;The folks over at &lt;a href="https://vectorized.io/" rel="noopener noreferrer"&gt;vectorized.io&lt;/a&gt; have created a Kafka-compatible message broker called RedPanda from the ground up in C++ which means you can use your existing Kafka apps with it and realize an instantaneous performance improvement. &lt;/p&gt;

&lt;p&gt;This also means that it should work with the existing Kafka Ecosystem including the aforementioned Solace PubSub+ Kafka Connector for WebSocket fanout.&lt;/p&gt;

&lt;p&gt;Here are the steps you need to take to spin up the entire stack:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Sign up for a &lt;a href="https://console.solace.cloud/login/new-account?product=event-streaming" rel="noopener noreferrer"&gt;FREE Solace PubSub+ Cloud Broker&lt;/a&gt; or download and run a &lt;a href="https://solace.com/products/event-broker/software/getting-started/" rel="noopener noreferrer"&gt;FREE Docker container&lt;/a&gt; to do the websocket fanout&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Download, install and run the &lt;a href="https://vectorized.io/docs/" rel="noopener noreferrer"&gt;RedPanda&lt;/a&gt; broker. It comes in many deployment options but I recommend the &lt;a href="https://vectorized.io/docs/quick-start-docker" rel="noopener noreferrer"&gt;docker installation&lt;/a&gt; for the easiest install&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Download the &lt;a href="https://kafka.apache.org/" rel="noopener noreferrer"&gt;Apache Kafka&lt;/a&gt; distribution to get access to the connect framework&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Compile the &lt;a href="https://github.com/SolaceProducts/pubsubplus-connector-kafka-sink" rel="noopener noreferrer"&gt;Solace PubSub+ Kafka Sink Connector&lt;/a&gt; after adding the following file as a message processor: &lt;a href="https://gist.github.com/TKTheTechie/872f4a8df0b85e53b33ff0c697c51aff" rel="noopener noreferrer"&gt;SolMarketdataProcessor.java&lt;/a&gt;. Follow the instructions in the github repo to add the compiled library to the Kafka Connect you got from the Apache Kafka distribution.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using a javascript library like &lt;a href="https://github.com/mqttjs/MQTT.js" rel="noopener noreferrer"&gt;MQTT.js&lt;/a&gt; you can now connect to the MQTT WebSocket port of your Solace PubSub+ broker using the following code as an example:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var mqtt = require('mqtt')
var client  = mqtt.connect('wss://host:port',{username:'username',password:'password'})

client.on('connect', function () {
  client.subscribe('US/NASDAQ/AAPL'); //Establish your topic subscriptions here
})

client.on('message', function (topic, message) {
  // message is Buffer
  console.log(message.toString())

})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can retrieve the host:port and credentials from the 'Connect' tab of your Solace Cloud Console:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fsolacese%2Flinking-vuex-stores%2Fraw%2Fmaster%2Fimgs%2Fmqtt-ws.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%2Fgithub.com%2Fsolacese%2Flinking-vuex-stores%2Fraw%2Fmaster%2Fimgs%2Fmqtt-ws.png" alt="MQTT Connect"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;or use ws://localhost:8000 for a broker deployed locally&lt;/p&gt;

&lt;p&gt;Here is an example of a market data stream sent over Solace via WebSocket to a web application - &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.solace.com%2Fwp-content%2Fuploads%2F2020%2F10%2Frunning-native-code-4.gif" 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%2Fcdn.solace.com%2Fwp-content%2Fuploads%2F2020%2F10%2Frunning-native-code-4.gif" alt="WebSocket Fanout"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Extending your deployment using a Solace PubSub+ Event Mesh
&lt;/h3&gt;

&lt;p&gt;The Solace PubSub+ Event Brokers allows you to wire together brokers to create a global multi-region (multi-cloud if need be) backbone for your event streams so you are fanning out in geographic proximity to your users. &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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fuprsmsbxu293dwjvza7p.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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fuprsmsbxu293dwjvza7p.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In addition, once your Kafka streams are liberated onto the Solace PubSub+ Event Mesh, it provides additional benefits some of which I listed here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://docs.solace.com/Overviews/ACL-Overview.htm" rel="noopener noreferrer"&gt;Access Control Lists&lt;/a&gt;: Provide fine grained permissions on a per topic basis so users can only subscribe to NASDAQ stocks for example.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://docs.solace.com/PubSub-Basics/Direct-Messages.htm" rel="noopener noreferrer"&gt;Throttling Feeds (Eliding)&lt;/a&gt;: Allows you to throttle feeds at configured interval - so you will only deliver 1 message per second to your web clients even though your Kafka cluster is getting 1000 messages per second &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On-Behalf-of Subscription Management - The ability for a microservice to inject subscriptions into a a WebSocket connection's session. This gives you the ability to add/remove subscriptions based on an entitlements lookup for example.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>redpanda</category>
      <category>kafka</category>
      <category>solace</category>
    </item>
    <item>
      <title>How to Use Rust, WebAssembly, JavaScript, and PubSub+ to Run Native Apps in Your Browser</title>
      <dc:creator>Thomas K</dc:creator>
      <pubDate>Thu, 15 Oct 2020 13:00:06 +0000</pubDate>
      <link>https://dev.to/solacedevs/how-to-use-rust-webassembly-javascript-and-pubsub-to-run-native-apps-in-your-browser-44l5</link>
      <guid>https://dev.to/solacedevs/how-to-use-rust-webassembly-javascript-and-pubsub-to-run-native-apps-in-your-browser-44l5</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%2F11%2Fblog-images-platform.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%2F11%2Fblog-images-platform.jpg"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;As the popularity of JavaScript has improved over the years, desktop applications have increasingly started moving away from thick-clients using languages such as .NET and Java to thin-clients like those built out with JavaScript. Frameworks such as &lt;a href="http://www.openfin.co" rel="noopener noreferrer"&gt;OpenFin&lt;/a&gt; and &lt;a href="https://www.electronjs.org/" rel="noopener noreferrer"&gt;Electron&lt;/a&gt; have exploded in growth in recent years because of this trend. However, browser-based JavaScript applications do not have the ability to call native code so browser-based JavaScript applications have been relegated, for the most part, to the presentation layer while more heavy weight processing has been moved to the server side. While this works well for a lot of the use cases as desktop and laptop computers continue to get upgraded with more cores, a tremendous amount of processing capability is being left unused.&lt;/p&gt;

&lt;p&gt;In this blog post, I will explain how using technology like Rust, WebAssembly, JavaScript (via the Svelte framework), and Solace PubSub+ enables you to reclaim some of that processing power while you continue to use your modern HTML5 applications through a very basic implementation of an options pricer in the browser.&lt;/p&gt;

&lt;p&gt;Whew … those were a lot of buzzwords. Let’s start by breaking each of them down.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Rust&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.rust-lang.org/" rel="noopener noreferrer"&gt;Rust&lt;/a&gt; is an exciting new programming language from the fine folks over at the Mozilla foundation. It’s a low-level language that offers extreme performance with no run-time since it targets the &lt;a href="https://llvm.org/" rel="noopener noreferrer"&gt;LLVM&lt;/a&gt;. This makes it ideal for embedded/low powered devices. Other notable features are the lack of a garbage collector, strong compile time checks (such as&lt;a href="https://doc.rust-lang.org/1.8.0/book/references-and-borrowing.html" rel="noopener noreferrer"&gt;the borrow checker&lt;/a&gt;), support for functional programming constructs (such as closures), and object oriented constructs (via traits). If you’d like to learn more, I highly recommend the &lt;a href="https://doc.rust-lang.org/book/title-page.html" rel="noopener noreferrer"&gt;Rust Book&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;WebAssembly&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;WebAssembly is a binary instruction format that is designed as a compilation target for programming languages allowing them to be deployed onto the web. It also allows for inter-op with JavaScript through a wasm.js module that you can load in your client-side applications. This allows you to take advantage of native code in your web applications.&lt;br&gt;
&lt;a href="https://solace.com/wp-content/uploads/2020/10/running-native-code-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%2Frunning-native-code-2-300x148.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Rust also includes first-class support for compiling down to WebAssembly. With its strong memory safety paradigms, it is an ideal language for this purpose.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Svelte&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://svelte.dev" rel="noopener noreferrer"&gt;Svelte&lt;/a&gt; is a no-nonsense JavaScript framework. It primarily differs from the more popular frameworks such as Angular, Vue, and ReactJS due to the fact that it compiles down to pure JavaScript without the need for a heavy framework library to be loaded, making it blazingly fast and the resultant apps extremely small.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Solace PubSub+&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Solace PubSub+ is an advanced event broker that has many advanced features such as the ability to form an &lt;a href="https://solace.com/what-is-an-event-mesh/" rel="noopener noreferrer"&gt;event-mesh&lt;/a&gt;, &lt;a href="https://cdn.solace.com/wp-content/uploads/2019/09/event-broker-diagram-new.jpg" rel="noopener noreferrer"&gt;native multi-protocol&lt;/a&gt; support, and it’s &lt;a href="https://solace.com/try-it-now/" rel="noopener noreferrer"&gt;FREE&lt;/a&gt;! Solace PubSub+ will form a core part of the architecture facilitating communication between WebAssembly, JavaScript, and a Rust process.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;An Example Using Options and Options Pricing&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;An option is a derivative financial instrument that gives the buyer the right to purchase/sell an asset at a specific price. It also allows for the seller of the options contract to generate income on assets that they have in their portfolio by taking a view on whether they see an upswing or downswing in the price of an asset.&lt;/p&gt;

&lt;p&gt;Let’s take an example. Say you think the price of AAPL is going to go above $125 from its current price of $100 after they announce the next iPhone. In such a situation, you can buy a CALL option for a strike price at $125 that expires at the end of September. What this means is that if by the end of September, the price of the AAPL stock reaches $150, having the option contract gives you the right to buy AAPL stock at $125 and you can instantly pocket the profit of $25 by selling AAPL back at $150 (minus how much it costs to purchase the option contract of course). However, if the price never reaches $125 by the end of September, your investment in the option becomes worthless and you lost your money. Likewise, a PUT option gives you the ability to sell an asset at a price in case you believe the asset will go down by a certain amount.&lt;/p&gt;

&lt;p&gt;Pricing an option is not a straightforward task as there are multiple factors associated with the price known as ‘&lt;a href="https://en.wikipedia.org/wiki/Greeks_(finance)" rel="noopener noreferrer"&gt;The Greeks&lt;/a&gt;’. While the math behind pricing an option goes beyond the scope of this blog post, I recently stumbled upon a blog post by &lt;a href="https://www.linkedin.com/in/ronnie-chowdhury/" rel="noopener noreferrer"&gt;Ronnie Chowdhury&lt;/a&gt; entitled &lt;a href="https://medium.com/@mushfaqueronniechowdhury/probably-the-fastest-black-scholes-pricer-in-world-34103e97f7eb" rel="noopener noreferrer"&gt;Probably the fastest Black Scholes Pricer in the world&lt;/a&gt;. I recommend reading through the post but the most interesting technical bit of information for me was a topic called &lt;a href="https://en.wikipedia.org/wiki/SIMD" rel="noopener noreferrer"&gt;SIMD&lt;/a&gt; that allows the CPU to perform multiple operations with one instruction set.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;With SIMD, instead we could instead act on multiple numbers together.&lt;/em&gt;&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%2F10%2Frunning-native-code-1.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%2F10%2Frunning-native-code-1.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;From the above we are iterating over each value and adding them one by one. But you would hope the compiler is clever enough to see that actually there’s an instruction _mm_add_ps() that could do 8 additions in 1 instruction. That’s  *&lt;em&gt;8x *&lt;/em&gt; faster.”&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I was able to make some small changes to Ronnie’s code which you can find &lt;a href="https://github.com/solacese/rust-wasm-js-options-pricer/black_scholes_option_pricer" rel="noopener noreferrer"&gt;here&lt;/a&gt; to allow it to be compiled to WebAssembly.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Bringing it all together&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;So, we have a highly performant options pricer implemented in Rust. I also created a &lt;a href="https://github.com/solacese/rust-wasm-js-options-pricer/options_pricing_web_app" rel="noopener noreferrer"&gt;Svelte WebApp&lt;/a&gt; that compiles the Rust code to WebAssembly and creates a binding to call this code from JavaScript. I also implemented a very bare-bones Rust Options Market Data Simulator that publishes option prices to Solace PubSub+ which you can find &lt;a href="https://github.com/solacese/rust-options-data-simulator" rel="noopener noreferrer"&gt;here&lt;/a&gt;. The Svelte app will consume these feeds from a Solace PubSub+ Event Broker and make a call to WebAssembly to price the option feed (note: the simulator spits out random data so the option prices generated by the pricer will not be realistic).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/10/running-native-code-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%2F10%2Frunning-native-code-3.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is an image of the application in action:&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%2F10%2Frunning-native-code-4.gif" 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%2F10%2Frunning-native-code-4.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To run this yourself, follow the instructions in &lt;a href="https://github.com/solacese/rust-wasm-js-options-pricer" rel="noopener noreferrer"&gt;this repo&lt;/a&gt;.&lt;/p&gt;

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

&lt;p&gt;While WebAssembly interop with JavaScript is arguably in its infancy and will see tighter integration and improved performance over time, hopefully the information and example in this post opens up your mind to the possibilities of using more of your desktop/laptop cores that are sitting idle on your computer for your modern web applications.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://solace.com/blog/rust-webassembly-javascript-solace-native-apps-browser/" rel="noopener noreferrer"&gt;How to Use Rust, WebAssembly, JavaScript, and PubSub+ to Run Native Apps in Your Browser&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>Linking Vuex State Machines Across Your Vue Client Applications with Solace PubSub+</title>
      <dc:creator>Thomas K</dc:creator>
      <pubDate>Thu, 30 Apr 2020 14:46:37 +0000</pubDate>
      <link>https://dev.to/solacedevs/linking-vuex-state-machines-across-your-vue-client-applications-with-solace-pubsub-135k</link>
      <guid>https://dev.to/solacedevs/linking-vuex-state-machines-across-your-vue-client-applications-with-solace-pubsub-135k</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LZe1lO9i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/04/blog-featured-image-vuex.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LZe1lO9i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/04/blog-featured-image-vuex.jpg" alt=""&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://vuejs.org/"&gt;Vue.js&lt;/a&gt; is a JavaScript framework developed by Evan You that’s making significant inroads as the framework of choice for modern single-page applications. One reason it has become so popular is that it comes with components any single-page-application is expected to have, such as a router, a developer UI to manage your application, and a state management library called Vuex. To learn more about Vue.js, visit the &lt;a href="https://vuejs.org/v2/guide/"&gt;Getting Started with Vue&lt;/a&gt; site.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Vuex?
&lt;/h2&gt;

&lt;p&gt;According to the &lt;a href="https://vuex.vuejs.org/"&gt;official web site for Vuex&lt;/a&gt;, it is a state management pattern and library for Vue.js applications. It serves as a centralized store for all the components in an application, with rules ensuring that the state can only be mutated in a predictable fashion. It also integrates with Vue’s official devtools extension to provide advanced features such as zero-config time-travel debugging and state snapshot export / import.&lt;/p&gt;

&lt;p&gt;Key to the architecture of Vuex are the concepts of state, views, and actions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;State serves as the source of truth that drives our applications&lt;/li&gt;
&lt;li&gt;The view is a declarative mapping of the state&lt;/li&gt;
&lt;li&gt;Actions are the ways the state could change in reaction to user inputs from the view&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gbCZmO27--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/04/vuex-post_pic-01.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gbCZmO27--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/04/vuex-post_pic-01.jpg" alt="Vuex State Machines: State, Actions, View"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A simplistic illustration of a Vuex workflow&lt;/p&gt;

&lt;p&gt;The Vuex store is instantiated within your application as a singleton, which means there is a single instance of the store that lives within your Vue application, and your various components look to it as the source of truth.&lt;/p&gt;

&lt;p&gt;What makes Vuex even more powerful and easier to use is its deep integration into the &lt;a href="https://chrome.google.com/webstore/detail/vuejs-devtools"&gt;Vue.Js  DevTool Chrome Extension&lt;/a&gt;, which allows you to look at the sequence of state mutations and even replay state changes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OeJWYJZm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/04/vuex-post_pic-02.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OeJWYJZm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/04/vuex-post_pic-02.jpg" alt="Vuex DevTool Browser Environment"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Example of the Vuex view in the Vuex DevTool browser extension&lt;/p&gt;

&lt;h2&gt;
  
  
  Why are state machines important for your JavaScript applications?
&lt;/h2&gt;

&lt;p&gt;State machines are becoming an increasingly important part of any modern application framework. With the pervasiveness of single-page application frameworks, it is also becoming a de facto part of front-end applications.&lt;/p&gt;

&lt;p&gt;Depending on the JavaScript framework you are using, there are a variety of choices such as &lt;a href="https://vuex.vuejs.org/"&gt;Vuex&lt;/a&gt; for &lt;a href="https://vuejs.org/"&gt;Vue&lt;/a&gt; and &lt;a href="https://redux.js.org/"&gt;Redux&lt;/a&gt; for &lt;a href="https://reactjs.org/"&gt;React&lt;/a&gt;. There is also a JavaScript framework-agnostic library called &lt;a href="https://xstate.js.org/"&gt;XState&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you are building an application, it will almost have ‘state’ associated with it. For front-end applications, your application state may include whether the user is logged in or whether the user is an admin. Compared to sprinkling and checking the logic for these transitions throughout your application, handling these states from a single location in your codebase is easier and less prone to errors. This is where a state machine library comes into play – typically exposed as a ‘&lt;a href="https://en.wikipedia.org/wiki/Singleton_pattern"&gt;singleton’&lt;/a&gt; and accessed from within your application, it provides a single source of truth for the state of your applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Implementing Vuex for a turn-based game
&lt;/h2&gt;

&lt;p&gt;Now let’s implement a basic Vuex container (state, actions, and mutations) for a turn-based game. Here are the key components we will need to implement:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;State

&lt;ul&gt;
&lt;li&gt;player – The ID of the player (Player1or Player2 )&lt;/li&gt;
&lt;li&gt;isTurn – Boolean value that represents whether it is the player’s turn&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Actions

&lt;ul&gt;
&lt;li&gt;logIn – sets the player’s id&lt;/li&gt;
&lt;li&gt;makeMove – Sends the move to the other player and swaps the turn off for the current player&lt;/li&gt;
&lt;li&gt;receiveMove – Receives a move from the other player and activates the current player’s turn&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is the bare-bones implementation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default new Vuex.Store({
  state: {
    player: '',
    isTurn: false
  },
  mutations: {
    LOGIN(state, player) {
      state.player = player
      if (state.player === 'Player1') state.isTurn = true
    },
    TOGGLE_TURN(state) {
      state.isTurn = !state.isTurn
    }
  },
  actions: {
    login({ commit }, player) {
      console.log('Attempting to login with ' + player)
      commit('LOGIN', player)
    },
    makeMove({ commit, getters }, move) {
      if (getters.isTurn()) {
        //TODO: Send a move to the other player
      }
    },
    receiveMove({ commit, getters }, otherPlayerMove) {
      if (!getters.isTurn()) {
        console.log(
          `Received move from other player ${JSON.stringify(otherPlayerMove)}`
        )
        commit('TOGGLE_TURN')
      }
    }
  },
  getters: {
    isTurn: state =&amp;gt; () =&amp;gt; {
      return state.isTurn
    },
    getPlayer: state =&amp;gt; () =&amp;gt; {
      return state.player
    }
  }
})
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Implementation gaps
&lt;/h2&gt;

&lt;p&gt;Now you’ve implemented a bare-bones skeleton of your Vuex store, but you may have noticed there are a few gaps.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You aren’t sending the ‘move’ object anywhere.&lt;/li&gt;
&lt;li&gt;How do you get notified if another player made a move?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Suppose this was a two-player game, the sequence expected would be as follows:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Player1 and Player2 log in.&lt;/li&gt;
&lt;li&gt;Player1 has his isTurn flag set to true and Player2 has his isTurn flag set to false.&lt;/li&gt;
&lt;li&gt;Player1 sends his move over to Player2.&lt;/li&gt;
&lt;li&gt;Player1’s isTurn flag is set to false.&lt;/li&gt;
&lt;li&gt;Player2 receives the move and sets his isTurn flag to true.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gfGyvDyP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/04/vuex-post_pic-03.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gfGyvDyP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/04/vuex-post_pic-03.jpg" alt="Diagram of communications between two VuEx instances"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We need a mechanism to establish communication between two different Vuex instances&lt;/p&gt;

&lt;h2&gt;
  
  
  Using Solace PubSub+ Event Broker to distribute your Vuex state
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://solace.com/products/event-broker/"&gt;Solace PubSub+ Event Broker&lt;/a&gt; is a multi-protocol, fully featured and free-to-use event broker. One of the many transports that it supports is WebSocket for both Node.js and a browser, which makes it ideal for solving this particular problem.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/04/vuex-post_pic-04.jpg"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P2G-E9Hx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/04/vuex-post_pic-04-1024x703.jpg" alt="PubSub+ API and Protocol Support"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The APIs and protocols that Solace PubSub+ Event Broker natively supports&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The APIs and protocols that Solace PubSub+ Event Broker natively supports&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting started with the PubSub+ Event Broker
&lt;/h3&gt;

&lt;p&gt;To get started with PubSub+ Event Broker, you &lt;a href="https://console.solace.cloud/login/new-account"&gt;create&lt;/a&gt; a new Solace cloud messaging service (for FREE!). If you need help with creating a messaging service, refer to this &lt;a href="https://docs.solace.com/Solace-Cloud/ggs_signup.htm"&gt;guide&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Publish events from your Vuex store
&lt;/h3&gt;

&lt;p&gt;Now in your makeMove(…) action, we  can change the code as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;makeMove({ commit, getters }, move) {
      if (getters.isTurn()) {
        console.log(
          `Sending ${JSON.stringify(move)} to ${getters.getPlayer()}/Move`
        )
        mqttClient.publish(`${getters.getPlayer()}/Move`, move).then(() =&amp;gt; {
          commit('SWAP_TURN')
        })
      }
    }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Note you are now sending a message on a well-defined topic ‘Player1/Move’ or ‘Player2/Move’ with the move payload.&lt;/p&gt;

&lt;h3&gt;
  
  
  Subscribing to move events from the other player
&lt;/h3&gt;

&lt;p&gt;Now how do you get notified when another player, connected from another browser, makes a move?&lt;/p&gt;

&lt;p&gt;In your view (in the beforeMount() lifecycle hook, for example) you will simply make use of a subscription function which may look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//Subscribe to the other player's move message
     this.$mqttClient
       .subscribe(
          'Player2/Move',
         ({ topic, message }) =&amp;gt; {
           store.dispatch('receiveMove', message)
           //rest of your business logic
         }
       )
       .then(() =&amp;gt; {
         console.log('Succesfully subscribed')
       })
   })
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You are adding a subscription to the topic ‘Player2/Move’ if you are ‘Player1’ or ‘Player1/Move’ if you are ‘Player2’. Your callback will instantaneously be triggered once you get a message with the event on the topic.&lt;/p&gt;

&lt;p&gt;Your finished product will look something like this across two browser windows:&lt;br&gt;&lt;br&gt;
&lt;a href="https://solace.com/wp-content/uploads/2020/04/vuex-demo-animated.gif"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YxaUkFUm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://solace.com/wp-content/uploads/2020/04/vuex-demo-animated.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  GitHub Repo
&lt;/h3&gt;

&lt;p&gt;To take a look at a fully built out sample implementation, navigate to this &lt;a href="https://github.com/solacese/linking-vuex-stores"&gt;linking-vuex-stores&lt;/a&gt; repo .&lt;/p&gt;

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

&lt;p&gt;In this post, I showed you how easy it is to link different Vuex stores together using simple publish/subscribe semantics via Solace PubSub+ Event Broker.&lt;/p&gt;

&lt;p&gt;While this works, you may realize that state is being distributed and controlled on the client side. Ideally you would want state to be validated and distributed from the server side. In a future post, we will show you how easy it is to add a node.js server using &lt;a href="https://xstate.js.org/"&gt;XState&lt;/a&gt; (a popular JavaScript state machine library) to this architecture to control and validate state on the server side while continuing to use Vuex on the client side.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://solace.com/blog/linking-vuex-state-machines-with-solace/"&gt;Linking Vuex State Machines Across Your Vue Client Applications with Solace PubSub+&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>Build a Proximity Detection System with a Raspberry Pi, Solace PubSub+, and JavaScript</title>
      <dc:creator>Thomas K</dc:creator>
      <pubDate>Tue, 31 Mar 2020 15:44:20 +0000</pubDate>
      <link>https://dev.to/solacedevs/build-a-proximity-detection-system-with-a-raspberry-pi-solace-pubsub-and-javascript-2hjl</link>
      <guid>https://dev.to/solacedevs/build-a-proximity-detection-system-with-a-raspberry-pi-solace-pubsub-and-javascript-2hjl</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NwUiGBb_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2018/10/LIGHT_What%25E2%2580%2599s-New-in-PubSub-Cloud-October-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NwUiGBb_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2018/10/LIGHT_What%25E2%2580%2599s-New-in-PubSub-Cloud-October-1.png" alt=""&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Have you ever wanted to tinker around with a Raspberry Pi and IoT but felt that it was too daunting? We’ve developed a set of instructions for you to build a proximity detection system using a Raspberry Pi with an ultra-sonic proximity sensor. The instructions include the materials you need to purchase, how to wire everything together, and the code required to build an application on top of it.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  &lt;strong&gt;What You Will Build&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In the &lt;a href="https://codelabs.solace.dev/codelabs/raspberry-pi-proximity-sensor/index.html"&gt;codelab&lt;/a&gt;, it runs you through step by step instructions of setting up your Raspberry Pi, wiring it to a proximity sensor, building an application in Javascript that reads the events from the proximity sensor, and publishing it to a Solace &lt;a href="https://solace.com/products/event-broker/cloud/"&gt;PubSub+ Event Broker: Cloud&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can now build microservices over proximity events triggered when someone comes close to the device!&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;JavaScript and IoT – Not Your Typical Combination&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;JavaScript is typically not a language you would associate with IoT, but with the advent of NodeJs, it is being used for more and more use cases outside of traditional web development. One of the frameworks that builds on Node is &lt;a href="http://johnny-five.io/"&gt;Johnny-Five&lt;/a&gt; – a general purpose IoT framework that works across multiple processor architectures such as SparkFun, Arduino, and Raspberry Pi. The codelab makes use of this framework to gather events from the sensor.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Exposing IoT Events Over Solace PubSub+&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Once you’ve detected an object within a certain proximity, what if you wanted to stream this as an event so that it can be picked up by microservices or a dashboard? That’s where &lt;a href="https://solace.com/products/event-broker/cloud/"&gt;Solace PubSub+ Event Broker: Cloud&lt;/a&gt; comes into play, a polyglot event broker that allows you to publish IoT events from your Raspberry Pi and subscribe to it with different applications and languages.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/03/exposing-iot-events.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A-g-4RL5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/03/exposing-iot-events.png" alt="Building a proximity detection system"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Take a look at the codelab &lt;a href="https://codelabs.solace.dev/codelabs/raspberry-pi-proximity-sensor/index.html"&gt;here&lt;/a&gt; and start building!&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://solace.com/blog/build-a-proximity-detection-system/"&gt;Build a Proximity Detection System with a Raspberry Pi, Solace PubSub+, and JavaScript&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>Building Battleship: A Hands-On Way to Learn How to Develop Event-Driven Microservices Using Spring Cloud Stream and TypeScript</title>
      <dc:creator>Thomas K</dc:creator>
      <pubDate>Fri, 13 Mar 2020 22:30:58 +0000</pubDate>
      <link>https://dev.to/solacedevs/building-battleship-a-hands-on-way-to-learn-how-to-develop-event-driven-microservices-using-spring-cloud-stream-and-typescript-3jb9</link>
      <guid>https://dev.to/solacedevs/building-battleship-a-hands-on-way-to-learn-how-to-develop-event-driven-microservices-using-spring-cloud-stream-and-typescript-3jb9</guid>
      <description>&lt;p&gt;The post &lt;a href="https://solace.com/blog/battleship-microservices-typescript/"&gt;You Sank My Battleship! A Hands-On Way to Learn How to Develop Event-Driven Microservices Using Spring Cloud Stream and TypeScript&lt;/a&gt; appeared first on &lt;a href="https://solace.com"&gt;Solace&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;When it comes to building modern applications (and especially microservices), understanding the basics of messaging and event-driven architecture can be critical, difficult, and maybe even boring – especially when you’re presented with a rich choice of languages (Java, TypeScript, etc.), frameworks (Spring Cloud Stream, Aurelia JS, etc.), and patterns to choose from (request/reply, etc.)!&lt;/p&gt;

&lt;p&gt;So, what better way to learn new tools and frameworks than by building something fun and familiar – an online version of the game Battleship! Take this free online course and in two hours you’ll build a working game of Battleship using TypeScript in Aurelia JS, Java in Spring Cloud Stream, and Solace &lt;a href="https://solace.com/products/event-broker/cloud/"&gt;PubSub+ Event Broker: Cloud&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solace.com/wp-content/uploads/2020/01/Battleship.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lUkJ2a3N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2020/01/Battleship-1024x549.png" alt="battleship with pubsub+, typescript, and spring cloud stream"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can take the course as a &lt;a href="https://codelabs.solace.dev/codelabs/solace-battleship/index.html"&gt;codelab&lt;/a&gt; and/or at &lt;a href="https://www.udemy.com/course/battleship-over-pubsub/?referralCode=BF575AB68D88AEF7289C"&gt;Udemy&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Is this course for you?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Yes, if you are an enterprise developer building modern, distributed applications. And if you’re interested in learning more about popular and up-and-coming languages/frameworks (TypeScript in Aurelia JS and Java in Spring Cloud Stream). Oh, and if you’re keen to learn more about message exchange patterns and how to leverage them in event-driven design this course is &lt;em&gt;definitely&lt;/em&gt; for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What should you already know?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;There are a couple things you should already have some experience with before signing up for the course:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Previous development experience is required&lt;/li&gt;
&lt;li&gt;  Basic understanding of transmission control protocol (TCP) and networking is beneficial, but not necessary&lt;/li&gt;
&lt;li&gt;  Java Development Kit&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What you will learn:&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  How to develop event-driven microservices using Spring Cloud Stream and TypeScript (a superset of JavaScript, a hot new language for web app development)&lt;/li&gt;
&lt;li&gt;  Best practices to implement event-driven architecture for web applications&lt;/li&gt;
&lt;li&gt;  Why and how to use request/reply (as well as other &lt;a href="https://solace.com/blog/messaging-patterns-for-event-driven-microservices/"&gt;message exchange patterns&lt;/a&gt;) over an &lt;a href="https://solace.com/what-is-an-event-broker/"&gt;event broker&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  How to take logic out of the browser and put client-side logic on the server (vs. in the browser)&lt;/li&gt;
&lt;li&gt;  The value of event-driven design in architecting a distributed system&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;How to get started: up your game with TypeScript and Java – for free!&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The Battleship course is broken into two components: Udemy videos and the codelab. The Udemy videos focus on the theory and fundamentals while the codelab applies the theory and fundamentals to an example application. Each lesson progressively builds in more functionality to the application.&lt;/p&gt;

&lt;p&gt;The best way to consume this course is to watch the Udemy videos first and then get your hands dirty by typing out the code snippets found in the codelab.&lt;/p&gt;

&lt;p&gt;If videos aren’t your thing, that’s okay — you’ll be able to complete the codelab without watching the Udemy video!&lt;/p&gt;

&lt;p&gt;Get started now!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;a href="https://www.udemy.com/course/battleship-over-pubsub/?referralCode=BF575AB68D88AEF7289C"&gt;Udemy: Battleship over PubSub+ with TypeScript and Java&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://codelabs.solace.dev/codelabs/solace-battleship/index.html#0"&gt;Codelab: Building Battleship with TypeScript, Java, and Solace PubSub+&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GcrOwNJm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://play.vidyard.com/ffoYww2W3DVSLEReAkJsjV.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GcrOwNJm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://play.vidyard.com/ffoYww2W3DVSLEReAkJsjV.jpg" alt="You Sank My Battleship! "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://solace.com/blog/battleship-microservices-typescript/"&gt;You Sank My Battleship! A Hands-On Way to Learn How to Develop Event-Driven Microservices Using Spring Cloud Stream and TypeScript&lt;/a&gt; appeared first on &lt;a href="https://solace.com"&gt;Solace&lt;/a&gt;.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Creating an OpenFin Event Mesh Across the Hybrid Cloud</title>
      <dc:creator>Thomas K</dc:creator>
      <pubDate>Fri, 03 May 2019 01:36:07 +0000</pubDate>
      <link>https://dev.to/solacedevs/creating-an-openfin-event-mesh-across-the-hybrid-cloud-231a</link>
      <guid>https://dev.to/solacedevs/creating-an-openfin-event-mesh-across-the-hybrid-cloud-231a</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_-LghH_f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2018/02/LIGHT_How-to-Enable-Any-Hybrid-Cloud-Architecture-with-Solace-and-PCF.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_-LghH_f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2018/02/LIGHT_How-to-Enable-Any-Hybrid-Cloud-Architecture-with-Solace-and-PCF.png" alt=""&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;In financial services, there is an old adage “the trend is your friend.” These days, the trend in every financial services firm is from the datacenter to the cloud. A &lt;a href="https://www.thomsonreuters.com/en/press-releases/2018/july/financial-firms-accelerate-their-move-to-the-cloud.html"&gt;recent survey&lt;/a&gt; by Thomson Reuters found that while cloud spend was 30% of financial firms’ IT budgets in 2017, it was expected to reach 47% by this year (2019).&lt;/p&gt;

&lt;p&gt;At most financial firms, OpenFin applications need to exchange data with a mix of services that include traditional datacenter resources, newer workloads deployed in the cloud, SaaS services, and a collection of other 3rd-party services. Let’s look at how the back-end landscape is changing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Datacenter applications.&lt;/strong&gt;  There are a few core applications like order routing and compliance that may never leave the datacenter, but most other applications are ripe for migration to the cloud. This could be via “lift and shift” using virtualization or containers, or a next-gen legacy replacement initiative that leverages powerful new cloud engines like machine learning or streaming analytics. In some cases datacenter applications are becoming hybrid with some of the workloads in the cloud and the rest staying in the datacenter.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JH9P01Ds--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-1-image-1.png" alt="A diagram showing how the back-end landscape is changing between public clouds and datacenters."&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SaaS solutions.&lt;/strong&gt;  The FinTech revolution is bringing to market new managed services that can replace traditional in-house applications at lower cost. Examples include fraud detection, data lineage (as part of compliance) and risk management.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;3rd-party services.&lt;/strong&gt;  The days of acquiring 3rd-party services over special VPNs or leased lines are coming to an end. When Bloomberg (&lt;a href="https://www.bloomberg.com/company/announcements/bloomberg-makes-real-time-data-available-cloud/"&gt;B-PIPE&lt;/a&gt;) and Thomson Reuters (&lt;a href="https://www.refinitiv.com/en/products/elektron-enterprise-data-management"&gt;Refinitiv’s Elektron&lt;/a&gt;) have a cloud-first strategy, you know it’s officially a trend. OpenFin’s rapidly growing app directory is filled with 3rd-party cloud services.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Achieving Service Location Transparency
&lt;/h2&gt;

&lt;p&gt;As you plan for OpenFin connectivity amidst ongoing services migration, it becomes essential to have a strategy to abstract service location out of app and service interactions. This is equally true for your OpenFin applications interacting with remote services and for the interplay between the services themselves.&lt;/p&gt;

&lt;p&gt;This is one of the many benefits of a messaging infrastructure, particularly one that can span both the datacenter and public clouds. A messaging infrastructure lets you declare which systems produce and consume which events, and uses queue or topic names to route the data. In this way, a back-end service can move from the datacenter to the cloud and the broker will dynamically re-route traffic with no changes to any OpenFin apps or other services. The same technique is used for disaster recovery and business continuity; if your primary cloud fails, traffic from your OpenFin apps can be instantly routed to an alternate public or private cloud.&lt;/p&gt;

&lt;h2&gt;
  
  
  OpenFin Service Integration
&lt;/h2&gt;

&lt;p&gt;The quickest way to get started is to use a multi-protocol broker solely to gateway your OpenFin applications to services across the hybrid cloud. The traffic flow looks like this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xyXGco2C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-1-image-2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xyXGco2C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-1-image-2.png" alt="A diagram showing how a multi-protocol broker acts as a gateway (between public cloud, datacenters and the front office) for OpenFin applications to reach other services across the hybrid cloud."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As outlined in the white paper &lt;a href="https://try.solace.com/wp-download-openfin-guide-to-connectivity/"&gt;A Guide to Connectivity for OpenFin Architects and Developers,&lt;/a&gt; Solace lets OpenFin applications use native web technology and still reach all your cloud, web and legacy services through its unique multi-protocol approach.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://try.solace.com/wp-download-openfin-guide-to-connectivity/"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VmcqK6gi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/OpenFin-Micro-campaign-Email-Header-Images-300x150.png" alt="OpenFin-Connectivity"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Global Event Mesh
&lt;/h2&gt;

&lt;p&gt;Many of our customers also need the same capabilities within individual clouds or datacenters, more like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3SBr7eJz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-1-image-3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3SBr7eJz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-1-image-3.png" alt="A diagram showing how PubSub+ works within clouds and datacenters (in the context of OpenFin applications)"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For example, in the diagram above, the left-most applications can use the broker deployed in AWS to manage that cloud’s events &lt;em&gt;and&lt;/em&gt; route data to the front office, datacenter, or other clouds. Any application anywhere in the hybrid cloud environment can subscribe to any set of events, and the brokers will dynamically coordinate what is needed where while switching protocols during data delivery as necessary.&lt;/p&gt;

&lt;h2&gt;
  
  
  Managed Public Cloud Event Mesh
&lt;/h2&gt;

&lt;p&gt;There’s even a managed service offering if you don’t want to manage the cloud infrastructure yourself. You can pay as you go, and Solace will assure uptime and capacity as needed. A single console will let you see all inter-service activity so you always have a complete picture of your data flow.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UdkezruS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-1-image-4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UdkezruS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-1-image-4.png" alt="A diagram showing how PubSub+ Cloud works with OpenFin applications and between public cloud and datacenters."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Which is Right for You?
&lt;/h2&gt;

&lt;p&gt;Whether you’re looking to rationalize service access just for OpenFin or want to transform your entire enterprise, Solace PubSub+ can simplify how your data flows and provide maximum flexibility as you shift workloads to the cloud over time. If you’d like to learn more about Solace PubSub+, PubSub+ Cloud, or a Solace-enabled event mesh, &lt;a href="https://dev.to/contact/"&gt;contact us today&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://solace.com/blog/openfin-event-mesh-hybrid-cloud/"&gt;Creating an OpenFin Event Mesh Across the Hybrid Cloud&lt;/a&gt; appeared first on &lt;a href="https://solace.com"&gt;Solace&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>usecases</category>
    </item>
    <item>
      <title>OpenFin Apps Need More Than Just REST</title>
      <dc:creator>Thomas K</dc:creator>
      <pubDate>Fri, 03 May 2019 01:16:34 +0000</pubDate>
      <link>https://dev.to/solacedevs/openfin-apps-need-more-than-just-rest-20gb</link>
      <guid>https://dev.to/solacedevs/openfin-apps-need-more-than-just-rest-20gb</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0YomrMGg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2017/01/DARK_Migrating-to-the-Hybrid-Cloud-Leave-Your-Legacy-Messaging-Behind.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0YomrMGg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2017/01/DARK_Migrating-to-the-Hybrid-Cloud-Leave-Your-Legacy-Messaging-Behind.png" alt=""&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;If you’re an OpenFin developer, you probably prefer to use REST for remote API calls whenever possible. This works great for query-response type requests, but has its limits beyond that, specifically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Service availability is binary.&lt;/strong&gt;  If the remote service is unavailable or overloaded, your app has to deal with the failure scenarios.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It’s a one-to-one protocol.&lt;/strong&gt;  If your app design is best served with a one-to-many exchange, REST isn’t a great choice.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It only works for web-based services.&lt;/strong&gt;  Many legacy services don’t present a REST API.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Using REST leads to tight coupling of apps to services.&lt;/strong&gt;  The endpoints are embedded into the application.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All of these limitations can be overcome by coupling REST with a multi-protocol message broker that natively supports web-based protocols. Your apps can still use web-friendly API management, and the broker handles service reliability issues, publish/subscribe and queueing semantics, and access to non-web legacy systems.&lt;/p&gt;

&lt;p&gt;Let’s take a look at three common scenarios and how OpenFin REST interactions can be improved with a message broker acting as an intermediary.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Request/reply to RESTful service&lt;/li&gt;
&lt;li&gt;Request/reply to a legacy service with a messaging interface&lt;/li&gt;
&lt;li&gt;REST as a publisher to multiple subscribers&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Scenario 1: Request/reply to RESTful service
&lt;/h3&gt;

&lt;p&gt;This is the pattern where REST is most straightforward. You simply POST (or PUT) and specify whether you want the interaction to be synchronous or asynchronous.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8uyZV3BZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-3-image-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8uyZV3BZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-3-image-1.png" alt="A diagram of OpenFin Direct to Service through a Solace PubSub+ advanced event broker"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I know what you’re thinking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;They both do the same thing, only the first one is simpler! Why add Solace?!?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There are three primary reasons people put a message broker between their REST POSTs and their RESTful services:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Buffering against failure.&lt;/strong&gt;  A message broker or queue is often used to simplify error handling in the client application. If the remote service is unavailable or heavily loaded, the broker will hold the messages until the service is restored or has caught up. The broker can easily be configured for fault tolerance and disaster recovery to provide instance or site failure recovery. With a direct REST request, if your POST fails it’s on you to manage the retries and handle the many failure scenarios.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Governance.&lt;/strong&gt;  If you have many types of messages going to many types of destinations across the datacenter, cloud and SaaS services, it can be very useful to manage security, logging and other governance operations in a single place.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Publish/subscribe.&lt;/strong&gt;  Sometimes it is useful for the message payload to go to multiple destinations (see scenario 3 later in this post).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;REST may be all you need if everything is a service lookup and everything is working, but distributed systems get messy, and a broker improves both reliability and governance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Scenario 2: Request/reply to a legacy service with a messaging interface
&lt;/h3&gt;

&lt;p&gt;Scenario 2 is still a point-to-point interaction, but this time the remote service does not offer a RESTful interface. We’ve discussed the architectural choices facing this scenario in detail in the whitepaper &lt;a href="https://try.solace.com/wp-download-openfin-guide-to-connectivity/"&gt;A Guide to Connectivity for OpenFin Architects and Developers&lt;/a&gt;. This time Solace is acting as a protocol and security bridge, terminating the REST request, forwarding the payload to a messaging queue or topic, and doing the same with the responses.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mwCYSi1b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-3-image-2-1024x194.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mwCYSi1b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-3-image-2-1024x194.png" alt="A diagram of OpenFin to Messaging Service through the Solace PubSub+ advanced event broker."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The means of receiving the response will vary depending on the nature of your REST request. If the request is synchronous, Solace will hold the connection open until the associated messaging interaction has completed. If the REST POST is asynchronous, you’ll need a means of receiving the message via callback, or polling for the results. There’s a companion blog post entitled &lt;a href="https://dev.to/blog/openfin-inbound-events-hybrid-cloud/"&gt;Handling OpenFin Inbound Events from the Hybrid Cloud&lt;/a&gt; that covers handling message flow in the other direction.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://try.solace.com/wp-download-openfin-guide-to-connectivity/"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VmcqK6gi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/OpenFin-Micro-campaign-Email-Header-Images-300x150.png" alt="OpenFin-Connectivity"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Scenario 3: REST as a publisher to multiple subscribers
&lt;/h3&gt;

&lt;p&gt;In scenario 3, the client application needs to post information to multiple remote services. Without a broker, the only way to do this is to have the application send the message to each application one by one, or write some kind of intermediary that forwards the message inside a RESTful service.&lt;/p&gt;

&lt;p&gt;Solace offers an elegant solution to this by allowing you to use REST to POST the data along with a publishing topic as metadata. Remote services identify themselves as subscribers and PubSub+ publishes onto many different messaging networks on the specified topic. The net effect is that your OpenFin apps use REST and the data automatically goes to all the subscribers, wherever they are. Some subscribers may produce a response, and others may simply listen, for example for logging or archival.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MgbwkH30--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-3-image-3-1024x467.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MgbwkH30--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-3-image-3-1024x467.png" alt="A diagram of OpenFin Publish/Subscribe through REST"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  All-of-the-Above
&lt;/h3&gt;

&lt;p&gt;Of course, many applications will want to include exchange patterns that accomplish all three of these scenarios. The all-of-the-above scenario highlights the governance and reliability advantages of using a broker.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a-OjA92w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-3-image-4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a-OjA92w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-3-image-4.png" alt="A diagram of OpenFin for all REST data exchanges"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If an application needed to use all of the message patterns we have discussed in this blog post, without a message broker, it would need to vary the use of REST, possibly handle security differently for each pattern, &lt;em&gt;and&lt;/em&gt; deal with all failure scenarios. With a message broker, it simply POSTs the data to Solace which acts as a security and traffic intermediary, routing to all data sources.&lt;/p&gt;

&lt;p&gt;Note: To keep the image above from overcrowding, I did not show the return messages. They would work the same as they did in the prior scenario diagrams above.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bolstering REST with Enterprise-Grade Resilience and Governance
&lt;/h3&gt;

&lt;p&gt;So there you have it, REST is awesome because it’s so simple—but it has some serious limitations. If operationalizing systems for predictability and high-availability, accessing legacy systems, or taking advantage of messaging-like semantics are requirements for your apps, consider adding a multi-protocol broker to bridge REST into other protocols and bolster your system’s resilience.&lt;/p&gt;

&lt;p&gt;Be sure to check out the companion post that discusses receiving notifications and responses from asynchronous REST requests: &lt;a href="https://dev.to/blog/openfin-inbound-events-hybrid-cloud/"&gt;Handling OpenFin Inbound Events from the Hybrid Cloud&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://solace.com/blog/openfin-apps-rest/"&gt;OpenFin Apps Need More Than Just REST&lt;/a&gt; appeared first on &lt;a href="https://solace.com"&gt;Solace&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>usecases</category>
    </item>
    <item>
      <title>Handling OpenFin Inbound Events from the Hybrid Cloud</title>
      <dc:creator>Thomas K</dc:creator>
      <pubDate>Fri, 03 May 2019 00:30:13 +0000</pubDate>
      <link>https://dev.to/tkthetechie/handling-openfin-inbound-events-from-the-hybrid-cloud-5ab0</link>
      <guid>https://dev.to/tkthetechie/handling-openfin-inbound-events-from-the-hybrid-cloud-5ab0</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pfllVhqu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2018/10/LIGHT_Kafka-Summit-2018-Insights.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pfllVhqu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2018/10/LIGHT_Kafka-Summit-2018-Insights.png" alt=""&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Fully integrating OpenFin applications with remote services requires a plan for how to best interact with those services. Most financial services firms have hundreds of applications and thousands of microservices, some of which consume events and some of which generate them. Some present web-native APIs, and many do not.&lt;/p&gt;

&lt;p&gt;We have previously talked about how &lt;a href="https://dev.to/blog/openfin-event-mesh-hybrid-cloud/"&gt;REST can be enhanced&lt;/a&gt; to handle the many outbound exchange patterns. In this post, we’ll be discussing a better way to organize OpenFin inbound events.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is an Inbound Event?
&lt;/h2&gt;

&lt;p&gt;For the purposes of this post, we’re defining inbound events as any asynchronous event received from a remote source. There are two main types of inbound events:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;A notification triggered from a service.&lt;/strong&gt;  In most cases, these will be in response to the user’s interest (explicit or implied) in the associated event. For example, a price alert, a risk threshold breach, a fraud event or news associated with a portfolio asset.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An asynchronous reply to a prior request.&lt;/strong&gt;  JavaScript encourages the use of non-blocking resources, and a remote request may result in a variable amount of time to do some work—from milliseconds to minutes. Most OpenFin apps will want to decouple the request and response and treat the latter as an inbound event. For example, if you submit a basket of trades on behalf of a client, you may want to receive a single event when all fills are complete.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Dealing with Inbound Events
&lt;/h2&gt;

&lt;p&gt;The client side of real-time inbound events is pretty straightforward. You set up a connection and callbacks for the different kinds of events you expect. JavaScript makes it easy to pass control to a function when an event arrives.&lt;/p&gt;

&lt;p&gt;The trickier part is choosing what is on the other end of that connection. Your app may be talking to a single remote service or many. It could be inside the datacenter, in a private or public cloud, or a 3rd-party service. The remote service may present a web, messaging or legacy interface. The remote services may also offer different approaches to security.&lt;/p&gt;

&lt;p&gt;There are many things to consider to inform the best course of action. Here are three:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The DIY option is to code your own WebSocket server and handle everything yourself. For example, if the remote service does not present a WebSocket event API. Your code will need to integrate with sources, negotiate handshakes, reformat payloads, and send heartbeat pings at intervals to assure the connection stays alive, and handle a range of errors.&lt;/li&gt;
&lt;li&gt;Some cloud and web-based APIs will include a WebSocket service interface within their APIs, doing that work for you. You code to an API, and the event handling happens under the covers.&lt;/li&gt;
&lt;li&gt;A multi-protocol event broker that supports WebSocket can act as an intermediary. For example, a Solace PubSub+ broker can coordinate with many services and consolidate inbound events back to the OpenFin client through one or more WebSocket links.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you are interacting with just one remote service, and it implements a WebSocket server, coding direction to its API may be a solid choice. The service will either document how to handle the matching WebSocket client, or it may provide a client-side JavaScript API to handle the connection and event management.&lt;/p&gt;

&lt;p&gt;In all other cases your easiest path forward will be to use an &lt;a href="https://dev.to/what-is-an-event-broker/"&gt;event broker&lt;/a&gt; to coordinate with the remote services. Let’s take a look at the many ways a Solace PubSub+ broker simplifies your event handling.&lt;/p&gt;

&lt;h2&gt;
  
  
  Provide the OpenFin App with a Unified Subscriber Model
&lt;/h2&gt;

&lt;p&gt;Whether your back-end is a cloud service with a web-based API, an internal service connected to an AMQP network, or the stodgy old mainframe holding the legacy crown jewels, your OpenFin app simply connects to the broker. The broker handles all the complexity of the various network topologies and differences in connection protocols. The broker will then stream or queue events for consumption by your application. Security is handled by broker-defined access control lists (ACLs) to verify which remote resources each user or application can use and how.&lt;/p&gt;

&lt;p&gt;Let’s take a look at how the broker would pass events from a few different service types.&lt;/p&gt;

&lt;h3&gt;
  
  
  Events from Web-Based Services
&lt;/h3&gt;

&lt;p&gt;It’s always easy to post to a cloud or web-based service using REST, but not as clear how best to receive an asynchronous event back. Often cloud architectures will rely on using some kind of intermediary storage like AWS S3, or a database, then ask the calling app to poll to read the stored data. Sometimes the remote service will include a WebSocket server, and will supply a JavaScript API that emits events to feed your callbacks.&lt;/p&gt;

&lt;p&gt;Many of our customers write their remote services to POST events to Solace using REST, and Solace can forward that event onto the client through a WebSocket. In OpenFin, the developer uses the Solace JavaScript API, and Solace uses WebSocket to signal anything that arrives for that app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--j1UsOXgf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-4-image-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--j1UsOXgf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-4-image-1.png" alt="A diagram of web originated events to OpenFin through the Solace PubSub+ broker"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Events from a Non-Web Service
&lt;/h3&gt;

&lt;p&gt;If the service does not present a web-friendly API, Solace becomes a peer on any popular messaging network and forwards events back to OpenFin. For example, Solace would subscribe JMS or AMQP topics, or identify queue names on behalf of the OpenFin app, to receive and forward inbound events over a WebSocket. Solace can even reach proprietary protocols like MQ or Kafka through a bridge so those events can reach OpenFin applications as well.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4fZD8O34--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-4-image-2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4fZD8O34--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-4-image-2.png" alt="A diagram of non-web originated events to OpenFin through the Solace PubSub+ event broker"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Subscribe to Events from Many Services
&lt;/h3&gt;

&lt;p&gt;In the companion blog post &lt;a href="https://dev.to/blog/openfin-apps-rest"&gt;about outbound requests&lt;/a&gt;, we showed how Solace allows a REST POST to be mapped into a publish/subscribe network for delivery to many services. The reverse pattern is also true for inbound. An app that receives events from many services can be simplified by having a broker stream or queue the events as an intermediary.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Bk0y-Fio--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-4-image-3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Bk0y-Fio--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-4-image-3.png" alt="A diagram of OpenFin Subscribe to Topic using the PubSub+ advanced event broker"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Events from “All of the Above”
&lt;/h3&gt;

&lt;p&gt;A broker is most useful when you have data going to and from many services. In large OpenFin installations, it is very common for many sources and many apps to need to freely exchange information.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--H0h13Zuv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-4-image-4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--H0h13Zuv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/openfin-blogpost-4-image-4.png" alt='A diagram titled "All Inbound OpenFin Events Through a Broker."'&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Coordinating Inbound Events with a Multi-Protocol Broker
&lt;/h2&gt;

&lt;p&gt;While you may have tight control over your OpenFin environment, the data sources those apps interact with are spread across clouds and datacenters, and have been created with different technologies over a span of decades. Just like a broker can help you do &lt;a href="https://dev.to/blog/openfin-apps-rest/"&gt;much more with REST&lt;/a&gt;, that same architecture can simplify inbound event management as well.&lt;/p&gt;

&lt;p&gt;For more on this topic, download our &lt;a href="https://try.solace.com/wp-download-openfin-guide-to-connectivity/"&gt;Guide to Connectivity for OpenFin&lt;/a&gt; that outlines the three architectural approaches developers and architects may choose to connect OpenFin applications to a variety of data sources:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://try.solace.com/wp-download-openfin-guide-to-connectivity/"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VmcqK6gi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://solace.com/wp-content/uploads/2019/04/OpenFin-Micro-campaign-Email-Header-Images-300x150.png" alt="OpenFin-Connectivity"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://solace.com/blog/openfin-inbound-events-hybrid-cloud/"&gt;Handling OpenFin Inbound Events from the Hybrid Cloud&lt;/a&gt; appeared first on &lt;a href="https://solace.com"&gt;Solace&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>usecases</category>
    </item>
  </channel>
</rss>
