70 likes | 180 Views
Cloud Service Bus. Legacy and In-house. VM. Bus Node. Bus Node. Bus Node. Bus Node. Mediation. Proxy. Mediation. Service. App. Bus Node. Bus Node. Bus Node. Bus Coordinator. Service. Service. App. App. Interface Overview. Pub/sub
E N D
Cloud Service Bus Legacy and In-house VM Bus Node Bus Node Bus Node Bus Node Mediation Proxy Mediation Service App Bus Node Bus Node Bus Node Bus Coordinator Service Service App App
Interface Overview • Pub/sub • Any client can publish messages to a “topic”; any client can subscribe to “topic” and get published messages • Radio-like • Fast and scalable distribution of real-time data • Best effort or partially reliable • Synchronous (both publisher and subscriber need to be online at the same time) • Queuing • Any client can send messages to a “queue”; any client can retrieve messages from a “queue” • Email for applications (with multiple readers) • Highly reliable (persistent) delivery of transactional data • Asynchronous (receivers can run and get data any time later) • Identical message order for all receivers • Slower and less scalable • Membership /attribute query and notifications • Query client population (“who has *flower*shop* in their description”, “who is located in Geneva”, “who listens to topic/queue A”) • Membership change notification (“notify me when client ABCD is down”) • Direct send/receive • Point-to-point (client A to client B) delivery of bulk data • Limited number of direct links • Limited quality of service • Later: service request/response, mediation (in-bus and external), mediation flow, proxies
Cloud Service Bus session • csb.client.Sessioncsb_session= CSBFactory.createSession(String domain, String client_id, Properties props, CSBEventListener, Object security_artifact); • Property example – client description • Contacts CSB Coordination service, gets address of busNode (plus one backup); connects to busNode • Throws • Existing client id exception • Events • busNode down, failing over to backup
Pub/sub • Topic t = csb_session.createTopic(String t_name, Properties t_config); • TopicPublishertp = csb_session.createTopicPublisher(Topic t, TopicEventListenerte_list, Properties tp_config); • tp.publishMessage(Message msg); • TopicSubscriberts = csb_session.createTopicSubscriber(Topic t, MessageListenerm_list, TopicEventListenerte_list, Properties ts_config); • MessageListener.onMessage(Message); • Two reliability levels • Best effort • In-memory acknowledged
Queuing • Queue q = csb_session.createQueue(String q_name, Properties q_config); • Throws queue exists with diff config exception • Queue q = csb_session.findQueue(String q_name); • QueueSenderqs = csb_session.createQueueSender (Queue q, Properties qs_config, QueueEventListenerqe_list); • qs.sendMessage(Message msg); • QueueReceiverqr = csb_session.createQueueReceiver (Queue q, MessageListenerm_list, QueuePositionstarting_point, Properties qr_config, QueueEventListenerqe_list); • Starting point can be Q front, tail or anything in between • MessageListener.onMessage(Message msg); • qr.deleteMessage(Message msg); • qs.deleteMessage(Message msg);
Membership/attribute query and notification • List<String> c_list= csb_session.membershipQuery(String key, String value/regexp); • Eg “clientDescription”=“*flower*shop*” • ClientAttributes ca = csb_session.retrieveClientAttributes(String client_id); • ca.getAttribute(“receivesFromQueues”) returns “FreddysFlowerShopBidInputQ” • Can send a bid to Freddy’s flower shop App • csb_session.registerInterest(InterestTypei_t, InterestParametersi_p, NotificationListenern_list) • Eg client is up, or down • NotificationListener.onNotification(Notification n);
Direct send/receive • DirectSenderds = csb_session.createDirectSender(String destClientId, Properties ds_config, DirectEventListenerde_list); • ds.sendData(byte[] data); • DirectReceiverdr = csb_session.createDirectReceiver(Properties dr_config, DirectEventListenerde_list, DataListenerd_list); • DataListener.onData(byte[] data);