warm-up video all right what is spark plug B for mqtt take zero all right thank you to easyvpn for sponsoring this video here all right in this video so if you have not gone back and watched the two videos from op about opcua and the two videos about mqtt which were released in August of 2021 go back and watch those videos very important in this video we're going to go over sparkk plug B what is it how does it work this is a video for the lay person we're going to do a 10,000 foot and a 5,000 foot discussion but we're going to get into some technical details okay I'm not going to go deep into the weeds so that we have people's eyes glaze over but we are going to get into some technical details all right so what is spark plug B for mqtt all right key elements okay we've already gone over this but some things I want to point out spark plug B the spark plug B specification which you can Google mqtt spark plug B is managed by the eclipse Foundation okay it is it was developed the spark plug B spec was written in 2016 by Cirrus link which is a company owned by the co-inventor of mqtt Arland Nipper they turned over that specification to the eclipse foundation in 2019 okay the spark plug B specification is a specification for packaging up industrial data and communicating it to a mqtt infrastructure structure okay it is based on the mqtt 3.1.1 standard so one of the first things that you learn about spark plug B is that it's an extension of the base mqtt 3.1.1 standard so obviously there will be a new release of the spark plug standard for mqtt 5 at some point mqtt 5 was released in 2019 hasn't really gotten wide adoption yet there are some key elements we're going to talk about here so I'm going to talk about group ID Edge ID and device ID here in a minute okay what's important to note is that we can package up mqtt payloads okay we can group them together and we can transmit them to a broker all packaged up nice and tidy instead of publishing individual topics to our broker okay and I'm going to get to all this here in a second so group ID Edge node ID and device ID are important Concepts or key elements it's basically The Logical grouping of your topic namespace supports store and forward so if the mqtt ient that you're using that implements spark the spark plug B spec this is how you get store in forward standardized stor and forward with mqtt using the spark plug B specification what is storing forward I have an mqtt client out here on the edge I've got all this stuff changing this is connected to sensors I've got all these values changing and this connection breaks okay so that I can't get the data to the broker and I got all my consumers out here this break storn forward means is that what we're going to do is we're going to go ahead and store all the events locally on the client and when this connection's reestablished we're going to go ahead and publish them all to the broker with the correct values and time stamps in the order that they happened they basically stream up in the order that they happened and because the time stamp of the value that gets to the broker comes from the client the clients out here it looks to them as if that disconnection was never there okay step stor forward another important component spark plug B specification has port for templates what does template mean it's userdefined data type templates in spark plug B okay a UDT it's basically a a data type object a template in spark plug B is the equivalent of a component spec in opcua we have support for compression in spark plug B so what is that is that I can spark plug B has support for us compressing the payloads and sending them to the the broker and the most important concept to understand with spark plug B is we create edge of network nodes okay and that's where I'm going to start so remember this spark plug b equals edge of network node okay we're going to create infrastructure so in order for me to explain what this is let's start with the normal nqt which we talked about in last month's videos okay so I've got my client and I have my client who has established my connection to my broker and I have subscribed to everything with a hashtag that means everything that's in the the broker name space I want you to send me the updates to with normal mqtt we call it vanilla mqtt so version 3.1.1 I can this client can do I could do things like let's do I have two companies right I've got intellic and I've got intellic Dallas and temperature okay I can publish intellic Dallas temperature to our broker okay the value whatever today it's 97° so the value would be 97 if I'm subscrib to everything I'm going to get that notification okay 97 at the same time with mqtt 3.1.1 I can also do this I could create a new namespace and I could have 4.0 Dallas and temp and I can publish these separately okay so I'm going to establish my con connection and I can publish both of these separately flat into my broker so 4.0 Dallas temp and let's say the value is 100 even though they're both in the same city so I would end up with 1 2 3 and 100° I would get notified 4.0 is a little hot okay 4.0 is a little hot all right that is your that's your vanilla mqtt the the beauty about mqtt 3.1.1 is that I can create a topic name space that I can basically piece together my unified namespace okay I can take values from sensors and using 3.1.1 I can basically put I can publish those values to basically anywhere okay what does spark plug B do okay so what I'm going to do is I'm going to create a spark plug B client okay so the difference between an mqtt 3.1.1 client and an mqtt spark plug B client is the mqtt spark plug B client is also an mqtt 3.1.1 client number one okay why cuz spark plug B is an extension of 3.1.1 so it's very important to note if I'm a spark plug B client I I natively support 3.1.1 as well okay because spark plug B is an extension of mqtt 311 what I'm doing with spark plug B is I'm creating an edge of network node okay so what I'm doing number one my goal is to create create an edge of network node which basically does this it creates a place in we'll just say these are Edge devices okay so these will be spark plug B devices so in my topic namespace I've got this thing called spark plug B Edge devices okay what I'm going to do with spark plug B is I'm going to package all my data up for one transmission okay so I'm going to create my connection C okay and I'm going to build my topic name space okay so these are all my tags my uh let's say temperature let's say it's all let's just list them as sensors sensor One Sensor 2 okay now what I'm going to do is I'm going to configure spark plug B to send my values to the mqtt broker and this is what it's going to look like I'm going to give it a group ID so in my configuration I'm going to give it a group ID and in this case I'll say the group is intellic okay so the group ID in this case is intellic I'm also going to give it an edge node ID I don't have to these are optional Edge node or device ID but I'm going to give it an edge node ID and we're going to call it whatever this Edge note is in this case we'll say it's Dallas thermostat and when I establish this connection I I want to avoid too many of the technical details okay there's some things that are going to happen when I package this all up okay out here in this spark plug B client what's going to happen is we are going to establish a birth that is this edge of node this end uh edge of uh edge of node node wait this is Edge of node device yeah edge of network device or node yep when I go ahead I'm going to do ahead and do a birth which is part this is part of the spec which will be stored in this name space there's a bunch of topics that are native to spark plug B I'm going to do a birth and then I'm going to give it a group ID in this case I'll give it an EDG node ID Dallas thermostat and then my sensors will be published here okay Sensor One sensor two if my client out here supports spark plug B it will be able to decipher this topic namespace how does this topic namespace look like when it's raw what does it look like when it's raw well they use protocol buffers so Google pro protuff I know is one of them and they use another one that that's optional they use Pro but they use protocol buffers to to send this data over the over the wire okay if I don't support spark plug B I can't really decipher what this is okay if I just look at it with an mqtt 3.1.1 client I subscribe to it it's just going to look like a jumbled mess you could you can kind of see a couple of the what what some of the stuff u mean like you'll be able to see the edge node actually in the Json but it'll be a jumbled mess okay so what I'm doing with spark plug B is I'm creating an end of network node I'm packaging everything up together and I'm there's some technical um elements like birth certificates and death certificates that don't exist with 3.1.1 so that up here what I can do is group all these edge of network node edge of network devices together okay so I can group many devices into the same group so I could use my thermostat I could use my my water heater I could use my plc's I could use my CMT svr anything that supports spark plug B and I can group them together logically at the broker Okay the reason we use spark plug B is because it was designed for industry it is designed for all the things that we care about with industrial data okay compression is a big component of it okay compression uh buffering so one of the things that we do with these with the spark blood B connection is we say how often often should we send our updates publish our updates to the broker so what'll happen is let's say I set that at 1 second and sensor one's value changes five times in 1 second the only one that gets shipped is the last one okay we publish the last value in that happened in that one second okay so there are a bunch of there are a bunch of elements of the spark plug B spec that allow us to optimize the transmission of industrial data okay but why does spark plug B matter okay what's the reason that it actually matters the reason it matters is is that it's far more efficient to use spark plug B for industrial applications because I can build my name space here I can manually I can build out a local namespace for this node okay organ uh hierarchy and a semantical namespace okay one that makes sense and then I can package it all up as one node and publish everything for that node up establish a connection now publish my logical namespace and then keep sending my updates as opposed to with mqtt 3.1.1 there are elements I'm missing okay number one but number two I'm sending each topic individually so if I've got 10,000 topics okay I don't want to have to do 10,000 publishes from my mqtt client I may not have want to do that it may make more sense for me to to package everything up nice and neat in an edge of network node and publish it to a specific space in our unified name space couple important things here number one my mqtt broker doesn't care whether my payloads are spark plug b or not okay so I could have a broker that can't decipher that is it can't unpack a spark plug B payload but that doesn't mean that it can't administer it for a client that can okay so as long as my broker is built on the mqtt 3.1.1 specification I can I can connect a spark plug B client to an mqtt 311 broker and a spark plug B client out here will be able to subscribe and and decipher the payload okay that's number one number two because of that I can put mqtt 311 1 mqtt 5 and spark plug B payloads all together okay where do I want to do this so what's the what's the application for spark plug B where do we do it okay one of the things that you'll remember in in our when we talk about the rules for digital transformation we treat all the smart things in our business as nodes in an ecosystem okay nodes is an e in an ecosystem so what we will do is we will group industrial data bi logical nodes in the organization a really good example would be a production line so I may have a production line that has multiple plc's okay and I have I may have an instance of ignition Edge running out there or an instance of factory tats sauce factory Studio or I may have an instance of flow software or I may have a canary Labs historian I may have not kepware because they don't support spark pu yet right I may have an IO Hub running out there I may have uh a PLC next running out there I may have a Groove an op22 Groove epic running out there and what I would do is logically group the data all the instrumentation data and any of the other data that I'm collecting in that node and then I would use spark plug B to package that edge of network node device all nice and neat for publishing to the broker or I could do it manually I could do the same thing except I'm not creating an edge of network logical grouping okay this gives me a lot more flexibility in how the data is going to be presented in the namespace I can take value from this sensor and I can put it over in this location in the namespace I can take value from that sensor and put it in that location in the namespace but anything that I send over spark plug b is all going to be grouped logically in the group ID that that connection is publishing to and in the device if I don't add a edge node Edge node ID then it's by default it's going to use the mqtt client ID in in that space go ahead for the edge of network device does the device ID have to be unique oh this is a one toone relationship oh okay Yep this is just an extra layer this is an extra layer and this is a common question that comes up in spark plug B is hey when you start building out Nam spaces you're going okay where where do I want to organize my data from my device out there where do I want to organize it this this a getting this right is important with spark plug B okay the the most common application for spark plug B for us though is basically two places number one when we're logically grouping by a production line or an area or a PLC and we say you know what that's an edge of network device and we want everything that's that I'm collecting to go to the same place in the namespace so let's go ahead and get all the advantages of spark plug B let's get compression okay let's leverage store and forward right all those things uh the protocol buffers let's let's leverage that stuff to optimize that transmission even further okay but number two is when I'm when I this sensor is a in in the opcua world would be like an information model from a companion spec the way that this is organized is a data type and I want the the clients out here to know that I'm consuming a data type the only way for us to do that seamlessly is by using spark plug B and the mechanisms and the specification to say hey this thing in the topic namespace is a template it is a userdefined data type it is a model it is a it's a data model okay all right so that's spark plug b in a nutshell okay spark plug B quick run through again it is a it is a standard managed by the eclipse Foundation telling you how to create logical edge of network nodes in your mqtt ecosystem that are optimized for publishing industrial data when you are building unified name spaces when you are building uh topic name spaces your topic Nam spaces topic Nam space is almost always a combination of purely flat mqtt 3.1.1 topics and Spark plub geese topics living alongside one another in the same name space and then we generally use our clients to manipulate this even further and normalize and unify okay so we I may take this value here and a value from this and put them together in a new logical area in the topic namespace okay number two spark plug B introduces the concept of a group ID an EDG node ID and a device ID and those things are part of our logical grouping for our sensor data and our spark plug B client number three we introduce support for store and forward using the spark plug B specification if I lose my connection I can buffer the data locally and then I can transmit once I reconnect we add in support for flagging topics as userdefined data types we can there are also other mechanisms in here I'm not there's a whole host other things that spark BL B I'm not highlighting here because there's no way for me to do it without basically boring the out of everybody we add in support for compression additional support for compression and we remember most important what is spark plug B for it's really for creating edge of network devices in our topic namespace okay so for every spark plug B connection that you have in your ecosystem you have an edge of network device a logical edge of network device that groups everything together okay that's it now let's get to the video