18
EMVP Session Mark Everard (@ev2000) Khurram Khan 27 th October 2015

Publisher / subscriber integrations using Episerver

Embed Size (px)

Citation preview

Page 1: Publisher / subscriber integrations using Episerver

EMVP Session

Mark Everard (@ev2000)Khurram Khan27th October 2015

Page 2: Publisher / subscriber integrations using Episerver

Exposing /retrieving content via publisher /subscriber integrations using EPiServer

Page 3: Publisher / subscriber integrations using Episerver

…Because I want to prove to my boss that I’m actually presenting today… Could any Instagram users please post a photo of the talk with the hashtag #ascend15 thanks

Page 4: Publisher / subscriber integrations using Episerver

ASP.NET

SQL

EPiServer CMS / Commerce

HTML / Pages

RSS / ATOM

Web-services (SOAP / REST)Custom implementation ServiceAPI

FTP / CSV

Triggers / Mirroring

How can expose my content?WebsitesMobile

SearchPIMDAMTranslation

BackupReportingDR

In-process or batch

Page 5: Publisher / subscriber integrations using Episerver

ServiceAPIService Layer available to allow update and retrieval of information from EPiServer (Commerce + CMS)• EPiServer implementation of ASP.NET WebAPI• Primary function to enable Commerce integrations (Catalog and Media)- Catalog- Media - CMS (bulk upload of .episerverdata files)

http://world.episerver.com/documentation/items/episerver-service-api

Page 6: Publisher / subscriber integrations using Episerver

Publish / SubscribeA messaging pattern allowing a system to publish a message to all interested receivers.• Loose coupling (publishers know nothing about subscribers)• Scalable (though publisher accepts load)• Flexibility (agree to one contract)

Loose coupling means that message delivery guarantees are more difficult though can be achieved, perhaps via an intermediary message broker or a convention.

Publisher

Subscriber

Subscriber

Subscriber

Page 7: Publisher / subscriber integrations using Episerver

RSS / ATOM FeedsRSS / ATOM is a web scale pub-sub implementation. A system subscribes to a feed to which the publisher adds updates / messages. Requires a polling approach from a subscriber.

Coincidentally, there’s a new version of Chief2moro.SyndicationFeeds

• Allows editors to create flexible feeds from EPiServer content• Filter by ContentType – new feature• Filter by Category – new feature• Further developer extension points (filtering and item summary)• Available as a Nuget package for CMS 9

https://github.com/markeverard/Chief2moro.SyndicationFeeds

Page 8: Publisher / subscriber integrations using Episerver

WebHooks“User defined HTTP callbacks”

Simple subscriber / publisher notification system for web based clients.

Notification delivery rather than polling

Available on many services already – social, cloud, payments etc

Page 9: Publisher / subscriber integrations using Episerver

…Captain Hook on the screen. How AMAZING! I really should post that to my Instagram with the

hashtag #ascend15

Page 10: Publisher / subscriber integrations using Episerver

WebHooksA subscriber sends a payload to subscribe to a particular notification. There is often basic authentication involved (app secrets and Id’s)

After a event the publisher looks at all relevant subscriptions and delivers message to all subscribers.

Messages are often lightweight containing notification of events rather than themselves detail about the events.

PublisherSubscriber

Subscriber

Subscriber

POST

I want to subscribe

Subscription store

Publisher

Subscription store

Event

Notifications

POST

Page 11: Publisher / subscriber integrations using Episerver

ASP.NET WebHooksLightweight framework gives you a pattern for building:

• Handling subscriptions from interested subscribers• Sending subscriptions to publishers• Sending published messages to subscribers• Handling publisher messages from subscribed services (via Receivers)

https://github.com/aspnet/WebHooks/

• Subscriptions gives you a way to manage and store subscriptions, and to make call-backs to all subscribed urls (hooks) at the right time.

• Receivers accept a defined HTTP payload from an external service (HTTP POST)

Page 12: Publisher / subscriber integrations using Episerver

ASP.NET WebHooksAlong with a basic framework for sending and handling subscriptions and publishing and receiving notifications, the ASP.NET implementation also provides some fleshed out integrations for the following services. Less work for you!

• Azure Alerts, Dropbox, GitHub, Kudu, Instagram, MailChimp, PayPal, Pusher, Salesforce, Slack, Stripe, Trello, and WordPress

Page 13: Publisher / subscriber integrations using Episerver

What abour Signalr?Signalr is also a messaging technology that also allows for non-polling communications between systems.

So what’s the difference?

• Signalr is for client to server communication, for example between browsers and webservers, allowing efficient and real-time data exchange

• WebHooks are for server to server communication relying on HTTP requests to Urls, for example GitHub notifying Azure to deploy a branch after a commit.

Page 14: Publisher / subscriber integrations using Episerver

EPiServer WebHooksWhat would an EPiServer implementation / usage of WebHooks look like?

• Publish content events to subscribers (system to system integration)

• Publish Form data inputs to external systems• Publish / Subscribe to Catalog events and changes from

integrated commerce systems (Stock control and pricing)• Subscribe to events from external systems (Payments)• Subscribe to external content events – Instagram anyone?

Page 15: Publisher / subscriber integrations using Episerver

Code – Example Inventory / Pricing WebHooks in Commerce

Page 16: Publisher / subscriber integrations using Episerver

“As a content editor, I want images that are uploaded on a social channel (Instagram) and tagged with ‘ascend15’ to be available in my content management system so I can use them on my awesome website”Have you posted your picture tagged with

‘ascend15’ yet? Live demo coming soon

Page 17: Publisher / subscriber integrations using Episerver

Code – Instagram WebHooks with EPiServer CMS

Page 18: Publisher / subscriber integrations using Episerver

Thanks