Uploaded image for project: 'JBeret'
  1. JBeret
  2. JBERET-386

Support custom codec in Cassandra item reader and writer

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 1.3.0.Final
    • 1.3.0.Beta7
    • jberet-support
    • None

      org.jberet.support.io.CassandraItemReader and org.jberet.support.io.CassandraItemWriter currently support a custom codec registry. But oftentimes it may be overkill to replace the built-in codec registry. In most cases, users just need to add a couple of custom codec but still using the built-in codec.

      If the Cassandra session is injected into item reader, writer or batchlet, then the application has full control of how to configure the cluster and creating session, including registering custom codec. And this should be the preferred approach as opposed to relying on batch properties for adding custom codec.

      Additionally, since an injected Session is usually shared resource between various parts of the application, or even among multiple applications, any custom codec configured with batch properties on CassandraItemReader, CassandraItemWriter or CassandraBatchlet should not export the mutation outside the batch artifact.

      Resources:
      https://docs.datastax.com/en/developer/java-driver/3.2/manual/custom_codecs/

      An example such a custom codec class (JodaTypeCodec):
      https://github.com/jberet/jsr352/blob/master/jberet-support/src/test/java/org/jberet/support/io/CassandraReaderWriterTest.java#L511

              cfang@redhat.com Cheng Fang
              cfang@redhat.com Cheng Fang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: