Monday, September 27, 2021

#880 OIC Pub/Sub with OCI Streaming Part 2

 Leading on from the previous post...


Here we have multiple subscribers, let's call them cg01 and cg02 - cg standing for consumer group. The previous post had 1 subscriber, now we are looking at 2. This is very easy to implement. One just needs separate integrations per subscriber, it's what you would require anyway. So let's check out my OIC artefacts -

AA-StreamingProducts-Subscribe is configured to subscribe as consumer cg01.

AA-StreamingProducts-Subscribe-CG02 is configured to subscribe as consumer cg02.


























Just to recap - the "publish" configuration is as follows - 


Now for a couple of tests to prove this works as we expect. I add a new product in Shopify - 




















I see the subscription to the new Shopify has fired and the publish integration has done it work - 
I run the cg01 "subscribe" integration - 
I now run the cgo2 "subscribe" integration - same result - 


So now I create 2 new products - Keg of Tucherbraeu and Keg of Doom Bar. I then run the "subscriber" for cg01. 


Ok, looks good. Now I add another product - Keg of Harp











I run the cg01 "subscribe" integration - 

it continues from the appropriate offset - 

I now run the cg02 "subscribe" integration - 

As you an see, I get the 3 new products added since the last "cg02" run.

Conclusion

It is very easy to do Pub/Sub with OIC and OCI Streaming. Regarding consumers - I need one integration per consumer. I do not need to create the consumers first in OCI Streaming. I just need to specify the consumer group when configuring the OCI Streaming invoke. OCI Streaming will check if the consumer group exists, if so, it will continue from the relevant offset, otherwise it will create the new consumer group. There is currently a limit of 50 consumers at OCI Streams level, this can be increased, if required. 

Finally, this example mentions various beers, please don't treat this as a recommendation to try out any of them, although I can vouch for their thirst-quenching powers.     

No comments: