use of com.xrtb.jmq.RTopic in project XRTB by benmfaul.
the class Spark method initialize.
/**
* Get the message handlers lashed up to handle all the accounting
* information.
*/
public void initialize() throws Exception {
// Instantiate your own logger if you
logger = new FileLogger(INTERVAL);
// don't want to log to files.
/**
* Win Notifications HERE
*/
String address = getAddress(zeromq, WINCHANNEL);
RTopic winners = new RTopic(address);
winners.addListener(new MessageListener<WinObject>() {
@Override
public void onMessage(String channel, WinObject msg) {
try {
processWin(msg);
} catch (Exception error) {
error.printStackTrace();
}
}
});
System.out.println("Ok Spark is running!");
address = getAddress(zeromq, BIDCHANNEL);
RTopic bidresponse = new RTopic(address);
bidresponse.addListener(new MessageListener<BidResponse>() {
@Override
public void onMessage(String channel, BidResponse msg) {
try {
processBid(msg);
} catch (Exception error) {
error.printStackTrace();
}
}
});
address = getAddress(zeromq, CLICKCHANNEL);
RTopic pixelandclicks = new RTopic(address);
pixelandclicks.addListener(new MessageListener<Object>() {
@Override
public void onMessage(String channel, Object msg) {
try {
processClickAndPixel(msg);
} catch (Exception error) {
error.printStackTrace();
}
}
});
}
use of com.xrtb.jmq.RTopic in project XRTB by benmfaul.
the class TestValidBids method testSetup.
@BeforeClass
public static void testSetup() {
try {
Config.setup();
Config.setup();
System.out.println("****************** TestValidBids");
RTopic bids = new RTopic("tcp://*:5571&bids");
bids.addListener(new MessageListener<BidResponse>() {
@Override
public void onMessage(String channel, BidResponse br) {
// System.out.println("<<<<<<<<<<<<<<<<<" + br);
response = br;
if (latch == null)
return;
latch.countDown();
}
});
} catch (Exception error) {
error.printStackTrace();
}
}
Aggregations