èªå® ã§Pubsubhubbubã®Pub,Sub,Hubä¸å¼ãåããã¦ã¿ã
ã¨ããããèªå® ã®Macã§Pubsubhubbubãåããã®ã§ã¡ã¢
ç°å¢
- Mac OS X 10.5.8
- Python 2.5.2
- Google App Engine SDK for Python 1.2.4 - 08/06/09
Pubsubhubbubã®ã½ã¼ã¹ããã§ãã¯ã¢ã¦ã
GoogleCodeã§ãã¹ãããã¦ãããªãã¸ããªããPubsubhubbubã®ã½ã¼ã¹ä¸å¼ããã§ãã¯ã¢ã¦ã
$ svn checkout http://pubsubhubbub.googlecode.com/svn/trunk/ pubsubhubbub-read-only
Hub,Publisher,Subscriberãèµ·åãã
Pubsubhubbubã«ã¯ä»¥ä¸ã®ãããªãã£ã¬ã¯ããªããããããããHub,Publisher,Subscriberã®ãªãã¡ã¬ã³ã¹å®è£ ãGAEã¢ããª(Python)ã¨ãã¦å®è£ ããã¦ããã
-
- hub/
- publisher/
- subscriber/
以ä¸ã®ããã«ã¿ã¼ããã«ãï¼ã¤ç«ã¡ä¸ãã¦ãããããã®ãã£ã¬ã¯ããªé ä¸ã§ä»¥ä¸ã®ã¨ããã¢ããªãèµ·åããã
ã¾ãHub
$ dev_appserver.py hub
Running application pubsubhubbub on port 8080: http://localhost:8080
ã¨ãã£ã¦ã¡ãã»ã¼ã¸ã表示ãããã°Hubã®èµ·åã¯æåã
ã¤ãã«Publisher
$ dev_appserver.py --port=8081 publisher
GAEã¢ããªã±ã¼ã·ã§ã³ã¯ããã©ã«ãã ã¨8080ãã¼ãã使ç¨ããã®ã§ãæ示çã«--port=8081
ã¨ãã¦Hubã¨ãã¼ãã競åããã®ãé¿ãã¦ããã
æå¾ã«Subscriber
$ dev_appserver.py --port=8082 subscriber
ãããåãããã«ãã¼ãã®ç«¶åãèµ·ããªããã--port=8082
ãæå®ãã¦ã«èµ·åããã
Hubãµã¼ãã®ãã¼ã¸ããã©ã¦ã¶ã§éãã¦ã¿ã
http://localhost:8080/ã«ãã©ã¦ã¶ã§ã¢ã¯ã»ã¹ãã¦ã¿ãã
以ä¸ã®ããã«è¡¨ç¤ºãããã
å®éã«GAEã§ãã¹ãããã¦ããã®ã¨ã»ã¼åãç»é¢ã ã
Subscriber:ãã£ã¼ããè³¼èªãã
ä¸è¨ãã¼ã¸ãä¸ã«ã¹ã¯ãã¼ã«ããã¨ã以ä¸ã®ããã«ãããã°ç¨ã®ãªã³ã¯ãç¾ããã
ãã®ãªã³ã¯ã®"Subscribe"ã®ãªã³ã¯ãéãã¨Subscriberãç»é²ãããã©ã¼ã ãç¾ããã
以ä¸ã®ããã«ãã©ã¼ã ãå
¥åã"Do it"ã®ãã¿ã³ãã¯ãªãã¯
ãã©ã¦ã¶ä¸ã«ä½ãå¤åãç¡ãã®ã§ä¸å®ã«ãªããã
Hubã®ã³ã³ã½ã¼ã«ã«ä»¥ä¸ã®ããã«è¡¨ç¤ºããã¦ããã°ãSubscriberã®ç»é²ã¯OK
INFO 2009-09-02 17:49:10,836 main.py:1393] Subscription action verified: subscribe INFO 2009-09-02 17:49:10,846 dev_appserver.py:3029] "POST /subscribe HTTP/1.1" 204 -
ã¡ãªã¿ã«subscriberã®ã³ã³ã½ã¼ã«ã«ã¯ä»¥ä¸ã®ããã«åºåããã¦ãããHubããè³¼èªç¢ºèªã®ãªã¯ã¨ã¹ããé£ãã§ãã¦ãããã¨ã確èªã§ããã
INFO 2009-09-02 17:49:10,818 dev_appserver.py:3029] "GET /subscriber.1?hub.verify_token=hoge&hub.challenge=Jf7d7Gd5rzluchT_Flmh3nHaAfEKCoNz6_nASQRCRJSMCrlO6vet0OE6mLHGZ1j6ctYFDp0wXXpYA-Ej6qu_PBKF7PthTHudiW6w8BYYS9kvRVyvUBzsLsz5qZXsf9FS&hub.topic=http%3A%2F%2Flocalhost%3A8081%2Ffeed&hub.mode=subscribe&hub.lease_seconds=2592000 HTTP/1.1" 200 -
Subscriberãç»é²ã§ããããhttp://localhost:8082/
ããã©ã¦ã¶ã§éãã¦ã¿ãã
Publisherã§ãã£ã¼ãã®æ´æ°ãçºçããããã®ãã¼ã¸ã«ãã£ã¼ãããããã¾åæ ãããã¯ãã ããã¾ã Publishãã¦ãªãã®ã§ãä½ã表示ããã¦ããªãã¯ãã
ã¨ããããããã®ãã¼ã¸ã¯éãã¦ããã
Publisher:ãã£ã¼ããçæãHubã«æ´æ°ãéç¥ãã
subscriberã®æºåãã§ããã®ã§ãPublisherã§æ°ããã¨ã³ããªããããªãã·ã¥ãã¦ã¿ãã
http://localhost:8081/
ããã©ã¦ã¶ã§éãã
ããã¨ãç°¡åãªã¡ãã»ã¼ã¸å
¥åãã©ã¼ã ã表示ãããã®ã§é©å½ã«å
¥åãã¦"submit"ãã¯ãªãã¯
ä¸ã®ã»ãã®"Previous message"ã£ã¦ã¨ããã«ãå ¥åããå 容ã表示ãããã°ã¡ãã»ã¼ã¸ã®ç»é²å®äºã
次ã«ãHubã«å¯¾ãã¦ãã£ã¼ããæ´æ°ããããã¨ãéç¥ããã
http://localhost:8080/ã®ãã¼ã¸ãéãã¦ãç»é¢ä¸é¨ã®"Publish"ã®ãªã³ã¯ãéãã
ããã¨ãPublishãããã£ã¼ããHubã«éç¥ããããã®ãã©ã¼ã ãç¾ããã®ã§ã以ä¸ã®ããã«å
¥åãã¦"Publish"
Hub:Publisherã®æ´æ°éç¥ãåãåãSubscriberã«éç¥ãã
æ¬æ¥ãªãããã®æç¹ã§Hubããã£ã¼ããåéãã¦ãããããã®Subscriberã«æ´æ°ãéç¥ããã¯ãã ãã©ãéçºãµã¼ãä¸ã§ããããããããã¤ãæä½æ¥ã§å¦çãå®è¡ããå¿ è¦ããã£ãã
æåã«ããã¿ã¹ã¯ã®å®è¡
http://localhost:8080/_ah/admin/
ãã¼ã¸ãéããéçºãµã¼ãã®ã³ã³ã½ã¼ã«ã表示ã
ããã¦"Task Queues"ã表示ããã
ä¸è¨ã®ããã«"feed-pulls"ã®ãã¥ã¼ã«1件ã®ã¿ã¹ã¯ãç»é²ããã¦ããã®ã§ã"feed-pulls"ã®ãªã³ã¯ãéãã¦ã"run"ã§ã¿ã¹ã¯ãå®è¡ããã
ããã¨ã次ã¯"event-delivery"ã¨ãããã¥ã¼ã«ã¿ã¹ã¯ãç»é²ãããã®ã§ããããåãããã«å®è¡ã
ããã§ãæ´æ°éç¥ã¨ãã¦Subscriberã«ãã£ã¼ãã®å 容ãPOSTãããã
Subscriber:åä¿¡ãããã£ã¼ãã®ç¢ºèª
ã§ãå
ã«éãã¦ãããSubscriberã®ãã¼ã¸http://localhost:8082/
ã確èªããã¨ã以ä¸ã®ããã«Publisherããã®ãã£ã¼ããåä¿¡ã§ãã¦ãããã¨ã確èªã§ããã
æåã§ã¿ã¹ã¯ãåãããªãã¨ãããªãã®ã§ããã¾ãããªã¢ã«ã¿ã¤ã æããç¡ããã©ãã¨ããããPubsushubbubã®ä¸å¼ãåãã®ç¢ºèªã§ããã
çå
- éçºãµã¼ãã§ã¯Task Queueã¯æåã§å¦çãããããªãã®ããªãï¼