changes in bbb-apps redis pubsub

This commit is contained in:
Marco Calderon 2011-02-22 21:45:20 +00:00
parent 0fdb2d4875
commit 3a19058d54
3 changed files with 107 additions and 0 deletions

View File

@ -0,0 +1,49 @@
package org.bigbluebutton.conference.service.recorder;
import redis.clients.jedis.JedisPubSub;
class PubsubListener extends JedisPubSub {
public PubsubListener() {
super();
}
@Override
public void onMessage(String channel, String message) {
System.out.println("pubsub "+channel+":"+message);
}
@Override
public void onPMessage(String pattern, String channel,
String message) {
// TODO Auto-generated method stub
}
@Override
public void onPSubscribe(String pattern, int subscribedChannels) {
// TODO Auto-generated method stub
}
@Override
public void onPUnsubscribe(String pattern, int subscribedChannels) {
// TODO Auto-generated method stub
}
@Override
public void onSubscribe(String channel, int subscribedChannels) {
// TODO Auto-generated method stub
}
@Override
public void onUnsubscribe(String channel, int subscribedChannels) {
// TODO Auto-generated method stub
}
}

View File

@ -0,0 +1,32 @@
package org.bigbluebutton.conference.service.recorder;
public class RedisListener extends RedisServer implements Runnable {
private PubsubListener pubsubListener;
public RedisListener(String server, int port) {
super(server, port);
// TODO Auto-generated constructor stub
}
public void subscribe(){
Thread t= new Thread(this);
t.start();
}
@Override
public void run() {
jedis.subscribe(pubsubListener, "bbbConferenceEvents");
}
public PubsubListener getPubsubListener() {
return pubsubListener;
}
public void setPubsubListener(PubsubListener pubsubListener) {
System.out.println("setting pubsub");
this.pubsubListener = pubsubListener;
}
}

View File

@ -0,0 +1,26 @@
package org.bigbluebutton.conference.service.recorder;
import java.io.IOException;
import redis.clients.jedis.Jedis;
public class RedisServer {
protected Jedis jedis;
public RedisServer(String server, int port) {
jedis = new Jedis(server, port,0);
jedis.set("foo", "bar");
}
public Jedis getJedis(){
return jedis;
}
public void closeConnection(){
try {
jedis.disconnect();
} catch (IOException e) {
e.printStackTrace();
}
}
}