import redis.clients.jedis.Jedis;
private Jedis jedis=null;
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException
{
if (first){
first = false;
/*connect to redis server*/
//连接本地的 Redis 服务
jedis = new Jedis("localhost");
logBasic("Connection to server sucessfully");
//查看服务是否运行
logBasic("Server is running: "+jedis.ping());
}
Object[] r = getRow();
if (r == null) {
setOutputDone();
return false;
}
r = createOutputRow(r, data.outputRowMeta.size());
String v=jedis.get("k1");
// Set a value in a new output field
get(Fields.Out, "k1").setValue(r, v);
// Send the row on to the next step.
putRow(data.outputRowMeta, r);
return true;
}