Exemplo n.º 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);
 }
Exemplo n.º 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());
      }
    }
  }
Exemplo n.º 3
0
 public void update(ColumnFamilyUpdater<K, N> updater) {
   updater.update();
   executeIfNotBatched(updater);
 }
Exemplo n.º 4
0
 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;
 }