publish-subscribe

Javascript pub/sub implementation works for functions, but not objects' methods

北城余情 提交于 2019-12-06 14:33:51
问题 I'm trying to implement a simple Pub/Sub object in javascript, and here's my code: var PubSub=new function(){ this.subscriptions=[]; this.subscribe=function(topic,callback){ if(!this.subscriptions[topic]){ this.subscriptions[topic]=[]; } this.subscriptions[topic].push(callback); } this.unsubscribe=function(topic,callback){ if(this.subscriptions[topic]){ for(var i=this.subscriptions[topic].length-1;i>=0;i--){ if(this.subscriptions[topic][i]==callback){ this.subscriptions[topic].splice(i,1); }

using WCF Callback and asp.net to implement publish/subscribe pattern

时光总嘲笑我的痴心妄想 提交于 2019-12-06 14:19:57
问题 This is my first web application with WCF. So please guide me as a new guy. I'm trying to use WCF Callback to implement publish/subscribe pattern. I would like to send the message from UserA to UserB or UserA to every client at the moment. I got an example from here . In my app, I use ASP.NET as a client to connect WCF service instead and I found a problem when I subscribe to WCF service. The WCF service does not hold any other clients object. So when I call GetAllClients(_guid) , it will

Pub/Sub and Content-Based Subscriptions

梦想与她 提交于 2019-12-06 11:57:59
I am in the beginning phases of designing a system that will be event-driven architecture (basic pub/sub). The actual tools and frameworks have not been selected yet, so this question is more conceptual than technology specific (though it will be done in .Net). A nearly perfect analogy for the situation is a financial trading system. Imagine a server that is constantly receiving market data (in real time or at intervals--it doesn't matter). The server will publish pricing updates for specific securities. For the purpose of this question, let's say there are 1000 securities that the server is

How to redirect the output of redis subscription

∥☆過路亽.° 提交于 2019-12-06 10:02:07
I am exploring redis to do pub/sub. I wanted to write a script that uses redis-cli to subscribe to a channel and dump whatever is published to a file. What I notice however is that redis-cli subscripe channel > output does not quite work. I'd appreciate any help very much. Regards, Kashyap This is because there is no automatic flush of stdout when redis-cli displays the messages associated to the subscription. So the last messages before stopping redis-cli do not appear in the output file. There is no option you can use to enforce a systematic flush, redis-cli.c needs to be patched. In Redis

What would be the behavior of subscriptions and notifications in an Orion Load-Balancing scenario?

我只是一个虾纸丫 提交于 2019-12-06 08:20:11
Based on this answer about how to scale Orion Context Broker with load balancing https://stackoverflow.com/a/33068119/3706998 what should be the behavior of subscriptions and also notifications? Witch server should it come from? What is the workflow? Could it cause some disturbe or cloned subscriptions ? Let's consider different cases, depending on subscription cache usage. Let's consider two Orion nodes (A and B) without loss of generality, both sharing the same MongoDB instance. Using subscription cache (i.e. -noCache is not set) The subscription creation request is dispatched to some of the

Loading a Meteor client app with fake fire-and-forget data

扶醉桌前 提交于 2019-12-06 06:54:32
I'm trying to figure out a good way to create tutorials for using Meteor apps. Visually, I've figured out a good approach, and packed this into a smart package: https://github.com/mizzao/meteor-tutorials . However, there is a second piece that turns out to be rather hard to figure out. In many cases, a tutorial app needs to be loaded with fake data, to demonstrate the interface to the user without requiring it to be populated with real data that may be hard to generate. (For example, see https://www.planapple.com/trip/demo/349/ which is a demo for PlanApple). In Meteor, since the content of an

Sharing Interfaces Between a WCF Service and Client (marked w/ ServiceContract)

妖精的绣舞 提交于 2019-12-06 05:17:23
问题 I'm using VS2010 and .NET 4.0. I've checked here (Sharing Interfaces that are implemented in WCF Service) but it differs in that what I'm trying to accomplish involves an interface that is marked with ServiceContract. I.e. in the service, I have an interface A (marked as a ServiceContract) and an extending interface B (also marked as a ServiceContract). B is implemented by the WCF service. The exact extension goes along the lines of this: public interface A<T> public interface B : A

How does a JMS Topic Subscriber in a clustered application server recieve messages?

流过昼夜 提交于 2019-12-06 05:08:22
Suppose I created a JMS Topic (PropertiesTopic) with one subscriber (PropertiesSubscriber). PropertiesSubscriber is running in a load balanced application server cluster as shown in the picture below. alt text http://www.freeimagehosting.net/uploads/be28c03781.png When a message is delivered to PropertiesTopic, do all the instances of PropertiesSubscriber running on different app servers get that message or does the message get delivered to only one PropertiesSubscriber instance running on an app server determined by the load balancer? JMS 2.0 introduces shared subscriptions . These allow

how to use the redis publish/subscribe

点点圈 提交于 2019-12-06 03:04:22
问题 Currently I am using node.js and redis to build a app, the reason I use redis is because of the publish/subscribe feature. The app is simply to notify the manager when user comes into the user or out of room. function publishMsg( channel , mssage){ redisClient.publish(channel,JSON.stringify()); } publishMsg('room/1/user/b',{'room':1,'user':'b'}); publishMsg('room/1/user/c',{'room':1,'user':'c'}); publishMsg('room/2/user/b',{'room':2,'user':'b'}); publishMsg('room/2/user/c',{'room':2,'user':'c

Modern alternative to publisher subscriber pattern

会有一股神秘感。 提交于 2019-12-06 01:56:12
I have a C++ Windows application. I am dealing with a publisher-subscriber situation, where one of my classes (publisher) generates data periodically and hands it off to another class (subscriber) which is constantly waiting to receive notification from the publisher. I am new to design patterns, and I looked up common implementations for publisher subscriber models, I noticed they are usually quite old, and they usually involve maintaining lists of pointers to objects. I was wondering if there is a better way of coding publisher subscriber model using C++ 11. Or using an entirely different