Beispiel #1
0
 /**
  * null check on the value to prevent {@link java.lang.IllegalArgumentException}
  *
  * @param updater
  * @param columnName
  * @param value
  */
 public static void addUpdateStringValue(
     ColumnFamilyUpdater<String, String> updater, String columnName, String value) {
   if (value == null) {
     return;
   }
   updater.setString(columnName, value);
 }
Beispiel #2
0
  private void writePayload(String messageKey, byte[] messageBodyBytes)
      throws ActionProcessingException {
    if (configuration.getDataStore().equals(DataStore.CASSANDRA)) {
      ColumnFamilyUpdater<String, String> updater = cfTemplate.createUpdater(messageKey);
      updater.setByteArray("body", messageBodyBytes);
      updater.setLong("timestamp", System.currentTimeMillis());

      try {
        cfTemplate.update(updater);
      } catch (HectorException ex) {
        throw new ActionProcessingException(
            "Got HectorException writing " + "message to data storage: " + ex.getMessage());
      }
    } else if (configuration.getDataStore().equals(DataStore.HBASE)) {
      try {
        // TODO need to write timestamp too?
        messagePersister.writeMessage(messageKey, messageBodyBytes);
      } catch (HBaseException ex) {
        throw new ActionProcessingException(
            "Got HBaseException writing " + "message to data storage: " + ex.getMessage());
      }
    }
  }
 public void update(ColumnFamilyUpdater<K, N> updater) {
   updater.update();
   executeIfNotBatched(updater);
 }
 public ColumnFamilyUpdater<K, N> createUpdater(K key, Mutator<K> mutator) {
   ColumnFamilyUpdater<K, N> updater = new ColumnFamilyUpdater<K, N>(this, columnFactory, mutator);
   updater.addKey(key);
   return updater;
 }