如何调试在 Cassandra 触发器中有错误的代码?
这是可能有错误的代码:
此代码将更新发送到另一个应用程序 SampleConsumer()
public Collection<Mutation> augment(ByteBuffer key, ColumnFamily update) {
LinkedList<Mutation> dummyReturn = new LinkedList<Mutation>();
SampleConsumer cons = new SampleConsumer();
String payload = "key="+key.toString()+"&";
// get the column names and their values in a string
for (CellName columnName : update.getColumnNames()) {
payload += (columnName.toString()+"="+update.getColumn(columnName).value().toString()+"&");
}
// This publishing to the consumer works perfectly if i hardcode a payload instead of calculating it.
cons.write(payload);
return dummyReturn;
}
使用 cqlsh 更新列族时出现此错误
[cqlsh 4.1.1 | Cassandra 2.0.7.31 | CQL spec 3.1.1 | Thrift protocol 19.39.0]
cqlsh> create TABLE store.users(user_name varchar PRIMARY KEY, password varchar);
cqlsh> CREATE TRIGGER ctrigger ON store.users USING 'com.castrigger.casNotify';
cqlsh> INSERT INTO store.users (user_name, password) VALUES ('sampleuser','samplepass');
**TSocket read 0 bytes**