Publish-Subscribe Model Overview Presented by: Ishraq Fatafta
AgendaO Introduction.O Publish-Subscribe model overview.O Publish-Subscribe a database perspective:  O Expressions.  O Con...
IntroductionO Traditional system-centric approach  O Request/Response query of data.  O Data volume and response time.O Da...
Introduction Cont.
Introduction Cont.O Publish-Subscribe model advantages:  O Enhanced response time.  O Enhanced results.  O Database resour...
Publish-Subscribe Model         OverviewO Described as events or pattern of events  produced by publishers that subscriber...
Publish-Subscribe Basic Model          Overview
Publish-Subscribe Basic Model       Overview Cont. O Decoupling types between publishers and   subscribers:    O Space dec...
Publish-Subscribe Model         Overview Cont.O Other communication models existed aside from publish-subscribe model:  O ...
Publish-Subscribe Model         Overview Cont.O Other communication models existed aside from  publish-subscribe model:  O...
Publish-Subscribe Model         Overview Cont.O Other communication models existed aside from  publish-subscribe model:  O...
Subscription modelsO Topic-based subscription model  O Also referred to as Subject-based models.  O subscriber shows inter...
Subscription models Cont.O Content -based subscription model  O Bound to the content of events themselves    rather than e...
Subscription models Cont.O Type-based subscription model  O Built using concepts from Object-Oriented.  O Events are objec...
Subscription related       characteristicsO Push and PullO Time driven and data drivenO Full update and incremental update...
Quality measures of publish-     subscribe servicesO Quality measures and metrics when designing any publish-subscribe mod...
Publish-Subscribe model:   Database PerspectiveO Publish-subscribe with expressions.O Continuous Query.O XML.
Publish-subscribe with             expressionsO Boolean expression used to specify subscribers‟  interest in an event by f...
Publish-subscribe with     expressions Cont.O Example: Interested in cars for saleO Brand Cadillac and price less than 350...
Publish-subscribe with          expressions Cont.  SubscriberI   Address   …    Interest  D                       …  100  ...
Publish-subscribe with      expressions Cont.O Queries can be simple, complex, with any type of  join.O Publishers can put...
Publish-subscribe with      expressions Cont.O Storing expressions as Table data  O Store these conditions as data in spec...
Publish-subscribe with     expressions Cont.O Evaluating expressions  O Evaluate operator is new to SQL.  O Conditional ex...
Publish-subscribe with          expressions Cont.   SELECT DISTINCT SUBSCRIBERS.SubscriberID,         (CASE WHEN SUBSCRIBE...
Continuous QueryO Queries constructed only once and stored    for continuous use over the database.O   Used over Append-On...
Continuous Query Cont.FOREVER DO       Execute Query Q       Return results to userSleep for some period of time.ENDLOOP
Continuous Query Cont.O Continuous query suffers some dis-efficiency:  O Non-deterministic results.  O Duplicate.  O Ineff...
Continuous Query Cont.O Incremental queries:       Set T. –∞       FOREVER DO               set t:= current time          ...
Continuous Query Cont.O To overcome duplicates, queries are transformed into Monotone  queries.O Queries whom results are ...
XMLO Importance of XML as a standard  information exchange mechanism.O Its capabilities of encoding structural  informatio...
XML Cont.
XML Cont.O XPath query is decomposed into a set of  path nodes using XPath parser.O Tags are extracted from these nodes an...
XML Cont.O SQL query can perform any DML  operation on them.O SQL query is ran recursively to match  XML messages with sub...
ConclusionO Publish-subscribe system consists of:  O publishers, who wish to disseminate    messages in a form of events t...
Conclusion Cont.O Database is used to match events and  subscriptions by evaluating events based on:  O Expressions provid...
Nächste SlideShare
Wird geladen in …5
×

Publish subscribe model overview

15.866 Aufrufe

Veröffentlicht am

Veröffentlicht in: Technologie, Business

Publish subscribe model overview

  1. 1. Publish-Subscribe Model Overview Presented by: Ishraq Fatafta
  2. 2. AgendaO Introduction.O Publish-Subscribe model overview.O Publish-Subscribe a database perspective: O Expressions. O Continuous query. O XML.O Conclusion
  3. 3. IntroductionO Traditional system-centric approach O Request/Response query of data. O Data volume and response time.O Data-centric approach O Publishers O Subscribers O Notification system
  4. 4. Introduction Cont.
  5. 5. Introduction Cont.O Publish-Subscribe model advantages: O Enhanced response time. O Enhanced results. O Database resources utilization and increased capacity. O Loosely coupled relationship between publishers and subscribers. O Scalability.
  6. 6. Publish-Subscribe Model OverviewO Described as events or pattern of events produced by publishers that subscribers interested in and notified when they are available.O Information has been referred to as Notifications in this paradigm.O Subscribers can continue their tasks until the notification service delivers notifications.
  7. 7. Publish-Subscribe Basic Model Overview
  8. 8. Publish-Subscribe Basic Model Overview Cont. O Decoupling types between publishers and subscribers: O Space decoupling: in which publishers and subscribers do not need to know each other. O Time decoupling: in which publishers and subscribers do not need to be running at the same time. O Synchronization decoupling: in which publishers and subscribers operations and tasks are not halted during publishing and receiving notifications. O Scalable system that fits well in distributed systems.
  9. 9. Publish-Subscribe Model Overview Cont.O Other communication models existed aside from publish-subscribe model: O Message passing: O Relies on messages for establishing communication between the sender and the receiver. O Message production done Asynchronously. O Message consumption done Synchronously. O Both need to be available in the same time. O Not decoupled in terms of time and space
  10. 10. Publish-Subscribe Model Overview Cont.O Other communication models existed aside from publish-subscribe model: O Remote call procedure (RPC): O Intends to make remote interactions looks the same as local interactions. O Coupled in time, space and synchronization. O Notifications: O Notifications sent by client to the server including callback arguments. O Notifications sent by server to the client including the result. O Coupled in time and space.
  11. 11. Publish-Subscribe Model Overview Cont.O Other communication models existed aside from publish-subscribe model: O Shared space: O Based on tuple-space: ordered collection of tuples accessed by all parties. O Adding and deleting tuples from tuple-space Synchronously. O Decouple time and space. O Message queuing: O Uses tuple-space, queues are provided with messages from producers and additional transactional, ordering and timing functionalities are provided by the message queue. O Same as Shared space.
  12. 12. Subscription modelsO Topic-based subscription model O Also referred to as Subject-based models. O subscriber shows interest in a particular topic and receives notifications filtered based on that. O Similar to joining to a group but more dynamic. O Hierarchy based. O Limited amount of expressions provided for subscribers to filter and limit their interested criteria. O Subscribe to more than one topic in a single subscription.
  13. 13. Subscription models Cont.O Content -based subscription model O Bound to the content of events themselves rather than external criteria. O Subscription language is used for filtering O CarBrand = „Mercedes‟ and Price <= 20,000 O StockName = „T*‟ and change > 3 O Needs more expressive criteria to determine which will generate a lot of traffic on the network. O More advanced and complex notification system to be able to filter each event and extract subscriptions
  14. 14. Subscription models Cont.O Type-based subscription model O Built using concepts from Object-Oriented. O Events are objects that can hold attributes and methods and notifications are objects of specific type. O Subscribers of specific object types will only receive instances of that type or its sub-types. O Performance issues when a large amount of events that need to be processed all at runtime.
  15. 15. Subscription related characteristicsO Push and PullO Time driven and data drivenO Full update and incremental updateO Broadcast and unicast data delivery
  16. 16. Quality measures of publish- subscribe servicesO Quality measures and metrics when designing any publish-subscribe model: O Reliability. O Security. O Priority. O Latency.
  17. 17. Publish-Subscribe model: Database PerspectiveO Publish-subscribe with expressions.O Continuous Query.O XML.
  18. 18. Publish-subscribe with expressionsO Boolean expression used to specify subscribers‟ interest in an event by filtering their criteria using name-value, comparison operators (=, >, >=, <, <=) and regular expressions.O We will use SQL and relational database.
  19. 19. Publish-subscribe with expressions Cont.O Example: Interested in cars for saleO Brand Cadillac and price less than 35000O Rules : ON Car4Sale IF (Model = ‘Cadillac’ and Price < 35000) THEN notify(‘abc@yahoo.com’)
  20. 20. Publish-subscribe with expressions Cont. SubscriberI Address … Interest D … 100 Amman … Model = „Cadillac‟ and …. Price < 35000 101 Irbid … Model = „Mercedes‟ …. and Year > =2007SELECT * FROM [SUBSCRIBERS]WHEREEVALUATE(SUBSCRIBERS.Interest, <DATA ITEM>) = 1
  21. 21. Publish-subscribe with expressions Cont.O Queries can be simple, complex, with any type of join.O Publishers can put limitations on predicates. SELECT * FROM SUBSCRIBERS WHERE EVALUATE(SUBSCRIBERS. Interest, <CAR DETAILS>) = 1 AND SUBSCRIBERS.Address = „Amman‟ ORDER BY SUBSCRIBERS.SubscriberID DESC
  22. 22. Publish-subscribe with expressions Cont.O Storing expressions as Table data O Store these conditions as data in special type columns. O Metadata is needed O To store information about values stored in the condition predicates. O A list of built-in and user-defined functions referenced by the condition. O Validate values stored when new or existing columns are modified. O Indexes can be added.
  23. 23. Publish-subscribe with expressions Cont.O Evaluating expressions O Evaluate operator is new to SQL. O Conditional expression is translated into a WHERE condition in SQL. O Expression Metadata used to determine the structure of the FROM clause. O The result returned is 1 (true) when the condition is satisfied.
  24. 24. Publish-subscribe with expressions Cont. SELECT DISTINCT SUBSCRIBERS.SubscriberID, (CASE WHEN SUBSCRIBERS.annual_income > 100000 THEN notify_salesperson (SUBSCRIBERS.PhoneNumber) ELSE create_email_msg (SUBSCRIBERS.EmailAddress ) FROM SUBSCRIBERS, INVENTORY WHERE EVALUATE(SUBSCRIBERS.Interest, <car details FROMINVENTORY>) = 1 AND Sub_DISTANCE(SUBSCRIBERS.Address,:DealerLoc,‟distance=50‟) = ‟TRUE‟ Group BY SUBSCRIBERS.SubscriberID
  25. 25. Continuous QueryO Queries constructed only once and stored for continuous use over the database.O Used over Append-Only databases.O First used to support Tapestry systems.O Uses time-based approach rather than triggers.O Uses a language called TQL (Tapes-try query language).
  26. 26. Continuous Query Cont.FOREVER DO Execute Query Q Return results to userSleep for some period of time.ENDLOOP
  27. 27. Continuous Query Cont.O Continuous query suffers some dis-efficiency: O Non-deterministic results. O Duplicate. O Inefficiency of the systemO To overcome this: O Incremental queries which run periodically. O Has two timestamps: last execution time (t) and current time (T). O Only results in the period (T-t) are returned.
  28. 28. Continuous Query Cont.O Incremental queries: Set T. –∞ FOREVER DO set t:= current time Execute query Q (z, t) Return result to user set T:= t Sleep for some period of time ENDLOOP
  29. 29. Continuous Query Cont.O To overcome duplicates, queries are transformed into Monotone queries.O Queries whom results are not increased as new tuples added to the database SELECT * FROM tbl WHERE tbl.field = “test” AND tbl.ts < t SELECT m.msgid FROM m WHERE NOT EXISTS( SELECT * FROM m ml WHERE ml.inreplyto = m.msgid AND t< ml.ts + 2 weeks )
  30. 30. XMLO Importance of XML as a standard information exchange mechanism.O Its capabilities of encoding structural information in documents.O Using XML in creating user profiles.O Using XFilters, which is a mechanism that matches XML documents to user profiles and relational databases, matched documents are returned using XPath to interested users .
  31. 31. XML Cont.
  32. 32. XML Cont.O XPath query is decomposed into a set of path nodes using XPath parser.O Tags are extracted from these nodes and stored in a TagPath table.O linear path is extracted from user subscription XPath profile and stored in the LinearPath table.O TagPath table is used to match linear paths in users‟ subscriptions with TagPath from XML documents.
  33. 33. XML Cont.O SQL query can perform any DML operation on them.O SQL query is ran recursively to match XML messages with subscriptions.O Values of stored path tags are used as predicates in the join
  34. 34. ConclusionO Publish-subscribe system consists of: O publishers, who wish to disseminate messages in a form of events to interested users, O Subscribers, who wish to be notified with these events by subscribing to them. O Notification management system that maintains a database with all publishers and subscribers.
  35. 35. Conclusion Cont.O Database is used to match events and subscriptions by evaluating events based on: O Expressions provided by subscribers in a form of queries stored in the database. O Continuous queries that target Append-only databases using a time-based approach. O XML that uses XFilters to match XML documents against user profiles, filter and return them using SQL queries in relational databases and XPath queries.

×