package eu.socialsensor.framework.client.search;

import org.apache.log4j.Logger;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

public class MediaSearcher {

	public final Logger logger = Logger.getLogger(MediaSearcher.class);
	public static final String CHANNEL = "searchRequestsChannel";
	
	private Jedis publisherJedis;
	
	public MediaSearcher(String searcherHostname) {
		JedisPoolConfig poolConfig = new JedisPoolConfig();
        JedisPool jedisPool = new JedisPool(poolConfig, searcherHostname, 6379, 0);
        
        this.publisherJedis = jedisPool.getResource();
        
	}
	
	public void search(String message) {
		try {
			publisherJedis.publish(CHANNEL, message);
		}
		catch(Exception e) {
			logger.error(e);
		}
	}
	
	public void delete(String message) {
		try {
			publisherJedis.publish(CHANNEL, message);
		}
		catch(Exception e) {
			logger.error(e);
		}
	}

}

@@ -641,25 +641,16 @@
 urce();%0A
-        %0A
 %09%7D%0A%09%0A%09pu
@@ -939,10 +939,336 @@
 %09%09%7D%0A%09%7D%0A%0A
+%09public void search(String message, String channel) %7B%0A%09%09try %7B%0A%09%09%09publisherJedis.publish(channel, message);%0A%09%09%7D%0A%09%09catch(Exception e) %7B%0A%09%09%09logger.error(e);%0A%09%09%7D%0A%09%7D%0A%09%0A%09public void delete(String message, String channel) %7B%0A%09%09try %7B%0A%09%09%09publisherJedis.publish(channel, message);%0A%09%09%7D%0A%09%09catch(Exception e) %7B%0A%09%09%09logger.error(e);%0A%09%09%7D%0A%09%7D%0A%09%0A
 %7D%0A

Add support for multiple channels In MediaSearcher client