Sample implementation of the RepraClient interface
package com.mycompany;
import com.sybase.connector.repra.RepraClient;
import com.sybase.connector.repra.logging.RaLogger;
import java.io.*;
public class SampleClient implements RepraClient
{
BufferedWriter _fout;
String _filename = "myCustomOut.dat"
// This method creates an instance of the BufferedWriter object
public void configureClient() throws Exception
{
_fout = new BufferedWriter(new FileWriter(_filename, true));
}
// You can do whatever you want in this method.
// This sample appends the String value of the message to the file.
public boolean sendEvent(Object repmsg) throws Exception
{
_fout.write(repmsg.toString(), 0, repmsg.toString().length());
_fout.newLine();
_fout.flush();
return true;
}
//It returns true if the client channel is ready.
//Otherwise, it returns false.
public boolean isReady()
{
if (_fout != null)
{
return true;
}
return false;
}
// This method closes the client channel.
public void close()
{
if (isReady())
{
try
{
_fout.close();
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
// This method sets the default logger. In this sample, it
// does nothing.
public void setLogger(RaLogger log)
{
}
}