Dear Wiki user, You have subscribed to a wiki page or wiki category on "Cassandra Wiki" for change notification.
The "ScribeToCassandra" page has been changed by mck. http://wiki.apache.org/cassandra/ScribeToCassandra?action=diff&rev1=2&rev2=3 -------------------------------------------------- Getting Scribe to write to Cassandra can be very easy by just implementing a custom scribe server. + Here's a super simple example written in java and using Hector. - It uses a column family according to the LogEntry's category, and puts the payload directly into a column name "scribePayload". + It uses a column family according to the {{{LogEntry}}}'s category, and puts the payload directly into a column name {{{"scribePayload"}}}. {{{ #!java class ScribeToCassandraService implements com.facebook.scribe.scribe.Iface { @@ -11, +12 @@ private static final String HOST_PORT = "localhost:9160"; private static final String KEYSPACE = "keyspace1"; private static final String COLUMN = "scribePayload"; - ... public ResultCode Log(final List<LogEntry> logEntries) throws TException { @@ -21, +21 @@ UUIDSerializer.get()); for (LogEntry logEntry : logEntries) { - try{ String payload = logEntry.getMessage(); String category = msg.getCategory(); @@ -35, +34 @@ UUID uuid = UUID.fromString(UUIDGenerator.getInstance().generateTimeBasedUUID().toString()); mutator.addInsertion(uuid, category, column); - }catch(Exception je){ // example catch code LOG.error("invalid LogEntry\n" @@ -45, +43 @@ } } mutator.execute(); - return ResultCode.OK; } ...
