@Bean public MessageHandler cassandraMessageHandler2() { CassandraMessageHandler cassandraMessageHandler = new CassandraMessageHandler(this.template); WriteOptions options = InsertOptions.builder() .ttl(60) .consistencyLevel(ConsistencyLevel.ONE) .build(); cassandraMessageHandler.setWriteOptions(options); cassandraMessageHandler.setOutputChannel(messageChannel()); cassandraMessageHandler.setAsync(false); return cassandraMessageHandler; }
/** * Create a new {@link InsertOptionsBuilder} to mutate properties of this {@link InsertOptions}. * * @return a new {@link InsertOptionsBuilder} initialized with this {@link InsertOptions}. */ @Override public InsertOptionsBuilder mutate() { return new InsertOptionsBuilder(this); }
/** * Create a new {@link InsertOptionsBuilder}. * * @return a new {@link InsertOptionsBuilder}. */ public static InsertOptionsBuilder builder() { return new InsertOptionsBuilder(); }
/** * Use light-weight transactions by applying {@code IF NOT EXISTS}. * * @return {@code this} {@link InsertOptionsBuilder} */ public InsertOptionsBuilder withIfNotExists() { return ifNotExists(true); }
/** * Insert {@literal null} values from an entity. This allows the usage of {@code INSERT} statements as upsert by * ensuring * that the whole entity state is persisted. Inserting {@literal null}s in Cassandra creates tombstones * so this * option should be used with caution. * * @return {@code this} {@link InsertOptionsBuilder} * @since 2.1 */ public InsertOptionsBuilder withInsertNulls() { return withInsertNulls(true); }