Tasty Topics!€¦ · Source: ICOMP 2016, A.L. Lee, Ranged Filtering of Streaming Numeric Data…...
Transcript of Tasty Topics!€¦ · Source: ICOMP 2016, A.L. Lee, Ranged Filtering of Streaming Numeric Data…...
TastyTopics!Novelapproachesusing
TopicFiltering
Pub/Subrevision• Distributed• Decoupled• Fanin/Fanout• Persistence• RegisterinterestinTopic
Imagecredit:pubnub.com
Topics
Topic≠ 𝑇𝑎𝑔!
food/apple/slices
*/*/slices=>
food/apple/slicesfood/ham/slices
food_apple_slices
List{food_apple_slices,food_ham_slices}Stringsearch?
WhoCares?• Simpler• Consistent• Reducesunnecessarydatacopies– E.g.InIoT reducesunnecessarysensorreads
UseCase1
MigratingYourDataFormat
Case1:MigratingYourDataFormat{“Person” : “Tom”,
“Team” : “Magicians”,
“Mobile” : “07746 244422”,
“EmployeeId” : 6
}
{
“Employee” :
[“Id” : “0000732006”,
“Name” : “Tom Fairbairn”,
“PhoneNum” : “+44(0)7746244422”,
“DirectReports”: [],
”ReportsTo”: “Ben Taieb”
]
}
CI/CD
“Employee” : [“Id” : “0000732006”, “Name” : “Tom
Fairbairn”,
Tag
Build
Test
Release
DataFormat– read/writeGson gson = new Gson();empolyeeData = gson.fromJson(data, employee.class);
public class employee {private String Person;private String Team;private String Mobile;public int EmployeeId;
…}
public class employee {private class employeeData {private String Id;private String Name;private String PhoneNum;private String[] DirectReports;private String ReportsTo;
}…}
Tag:v1.0 Tag:v2.0
DataFormattopicprivate String versionedTopic =
“london/employee/json/$GIT_TAG_NAME/[…]”;
session.subscribe(versionedTopic);
producer.send(message, versionedTopic);
UseCase2
Monitoring
Monitoring
Aquickdiversion
https://ip/endpoint
Websockets
Aquickdiversion-again
V1
V3
V5
Pub/SubMonitoringoverPub/Sub!
Pub/Sub
Anyapp Monitoringapp
Monitoring/ManagementAPI
MQTT ReST
UseCase3
Replay
DB
DB
DB
DB
DB
DB
DB
DB
DB
DB
DB
Dealingwithsharedstate– Ployglot persistence?– Replay“stateoftheworld”frommessagestream
Case3:Replay/Event-streaming
Replay– queuesthatcansubscribe
Queue
app/control
app/config
data/app/…
• QueueBrowser • TTL • LVQ
UseCase4
Authorisation
Case4:Authorisation
Pub/Sub
Application Subscriptionmanager
1. Request:log-in2. Servicecalculatessubscriptions3. Serviceappliessubscriptions
forapp4. ReplywithOK5. Appreceivesmatchingdata
OnBehalfOf
OnBehalfOf• Clienthasnoawarenessoftopics/services– Nochancetoguessotherservices– Nowork/exposureatclient
• Fullypluggablearchitecture
Authorisation
Pub/Sub
Anyapp Subscriptionapp
1. Requestaccountbalance2. Servicecalculatessubscriptions3. Servicesubscribesforapp4. Appreceivesmatchingdata
UseCase5
Findthenearest…Geo-locationusingtopics
Case2:FindTheNearest…InRealTime
Source:ICOMP2016,A.L.Lee,RangedFilteringofStreamingNumericData…usingTopic-BasedPub/SubMessaging
Geo-filteringtopicPublishtotopicwithlocation:<app>/<type>/<lat>/<long>/<vehicle>/<id>
geo/sim/51.520150/-00.097330/CAR/00021
WhereisCAR00021?subscribe(“geo/sim/*/*/CAR/00021”);
Geo-filteringlocationsubscribe(“geo/sim/51.52015*/-00.09733*/>”);
Match:lat 51.520150to51.520159long-000.097330to-000.097339
Geo-filteringlocationsubscribe(“geo/sim/51.52*/-00.09*/>”);
Match:lat 51.520to51.529999long-0.090to-0.099999
Geo-filteringlocationsubscribe(“geo/sim/51.52*/-00.09*/>”,
“geo/sim/51.516*/-00.092*/>”,
“geo/sim/51.516*/-00.093*/>”,
“geo/sim/51.516*/-00.094*/>”,
“geo/sim/51.516*/-00.096*/>”,
“geo/sim/51.517*/-00.092*/>”,
“geo/sim/51.517*/-00.093*/>”,
“geo/sim/51.517*/-00.094*/>”,
“geo/sim/51.517*/-00.096*/>”,
// repeat for 51.518 and .519
);
Geo-filteringlocation• Createanypolygon
– Accuracyatmetrelevel
– Circles,arcs…• Subscriptions
generatedonce• Matchesthen
streaminwithnoextracomputation
Geo-filteringlocationalgorithm• Dividespaceintorectanglesalignedtosubscriptions• Throwawayrectangleswithnomatch
Geo-filteringlocationalgorithm• Repeat:divideremainingrectanglesby10• Throwawayrectangleswithnomatch
Geo-filteringlocationalgorithmdeployment
• Library?
Pub/Sub
Geo-filteringapp Subscriptionapp
1. Requestsubscriptionsforshape2. Servicecalculatessubscriptions3. Servicesubscribesforapp4. Appreceivesmatchingdata
Lastcodesnippetif
Topic
then
Monitoring
ComeandseeusatourBooth!