Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.
Publish /
Subscribe
Alexandru Badiu
Me
Alexandru Badiu
Drupal user and contributor since 2003
Adulmec LLC
Drupal Romania
Drupal.ro
We’re goning to talk about
 What is Pub/Sub
 Pub/Sub in Drupal
 Basic usage
 Advanced features
 Integration with 3rd party...
What is Pub/Sub?
 Messaging paradigm
 Sibling of Message queues
 Publisher, Subscriber, Broker
 Decoupled
 Topic based
 Co...
What is Pub/Sub?
 Advantages
   Loosely coupled
   Scalable
 Disadvantages
   Not so scalable on large deployments
   Loos...
What is Pub/Sub?
Pub/Sub in Drupal
 Not pure Pub / Sub
 Content synchronization (tightly coupled)
 Content propagation (loosely coupled)
 D...
Pub/Sub in Drupal
 Topics are defined by views
 Content filtering is done via filters
 node_save() and alternatives
 Supports...
Basic usage - Demo
 Set up taxonomies
 Set up a publisher and a channel
 Set up a subscriber to that channel
 Add some nod...
Advanced usage - Demo
 Using the filters
 Node reference
 Deletion propagation
 Syncing uploaded files
 Excluding nodes
 Tyi...
Integration
 hook_publish_prepare(&$node)
 publish_node_was_changed($nid)
 hook_subscribe_presave(&$node)
 hook_subscribe_...
Integration
         hook_publish_prepare(&$node)


      function flag_pub_sub_publish_prepare(&$node) {
        $flag = fla...
Integration
            hook_subscribe_postsave(&$node)


      function flag_pub_sub_subscribe_postsave(&$node) {
        ...
Integration
         publish_node_was_changed($nid)



         _bulk_media_update_statistics($nid);
         if (module_e...
Case study:
Urbo.ro
‣We use Pub / Sub to sync nodes
‣Custom modules for extra data
‣21 channels and subscriptions
‣57 k no...
Thanks
                 andu@ctrlz.ro
http://ctrlz.ro / http://corporate.adulmec.ro
     Photo credit: Flickr users Gl3am,...
Nächste SlideShare
Wird geladen in …5
×

Publish and Subscribe

Presentation on Publish and Subscribe from Drupalcamp Timisoara 2010.

  • Loggen Sie sich ein, um Kommentare anzuzeigen.

  • Gehören Sie zu den Ersten, denen das gefällt!

Publish and Subscribe

  1. 1. Publish / Subscribe Alexandru Badiu
  2. 2. Me Alexandru Badiu Drupal user and contributor since 2003 Adulmec LLC Drupal Romania Drupal.ro
  3. 3. We’re goning to talk about What is Pub/Sub Pub/Sub in Drupal Basic usage Advanced features Integration with 3rd party modules Case study: Urbo.ro
  4. 4. What is Pub/Sub? Messaging paradigm Sibling of Message queues Publisher, Subscriber, Broker Decoupled Topic based Content based Push Pull
  5. 5. What is Pub/Sub? Advantages Loosely coupled Scalable Disadvantages Not so scalable on large deployments Loosely coupled
  6. 6. What is Pub/Sub?
  7. 7. Pub/Sub in Drupal Not pure Pub / Sub Content synchronization (tightly coupled) Content propagation (loosely coupled) Domain module alternative A hybrid system (topic and content based) The content are nodes Supports Pull and Push Uses XML-RPC
  8. 8. Pub/Sub in Drupal Topics are defined by views Content filtering is done via filters node_save() and alternatives Supports private channels Token based security Works with most CCK field types (no userreference) Syncs taxonomy terms Syncs files uploaded to nodes Deletion propagation
  9. 9. Basic usage - Demo Set up taxonomies Set up a publisher and a channel Set up a subscriber to that channel Add some nodes into the queue Push Pull
  10. 10. Advanced usage - Demo Using the filters Node reference Deletion propagation Syncing uploaded files Excluding nodes Tying nodes together
  11. 11. Integration hook_publish_prepare(&$node) publish_node_was_changed($nid) hook_subscribe_presave(&$node) hook_subscribe_postsave(&$node)
  12. 12. Integration hook_publish_prepare(&$node) function flag_pub_sub_publish_prepare(&$node) { $flag = flag_get_flag(FLAG_PUB_SUB_FLAG_NAME); if ($flag == null) { return; } if (!$flag->is_flagged($node->nid)) { return; } $node->flag_pub_sub = array( FLAG_PUB_SUB_FLAG_NAME => true, ); }
  13. 13. Integration hook_subscribe_postsave(&$node) function flag_pub_sub_subscribe_postsave(&$node) { $flag = flag_get_flag(FLAG_PUB_SUB_FLAG_NAME); if ($flag == null) { return; } if ($node->flag_pub_sub[FLAG_PUB_SUB_FLAG_NAME]) { $flag->flag('flag', $node->nid); } }
  14. 14. Integration publish_node_was_changed($nid) _bulk_media_update_statistics($nid); if (module_exists('publish')) { publish_node_was_changed($nid); }
  15. 15. Case study: Urbo.ro ‣We use Pub / Sub to sync nodes ‣Custom modules for extra data ‣21 channels and subscriptions ‣57 k nodes managed
  16. 16. Thanks andu@ctrlz.ro http://ctrlz.ro / http://corporate.adulmec.ro Photo credit: Flickr users Gl3am, nidhug and scattered sunshine.

×