Class Tm1SessionBatch

java.lang.Object
io.skipcheck.tm1.client.session.Tm1SessionBatch

public final class Tm1SessionBatch extends Object
A JSON $batch being put together: session() is a view of the session whose requests are queued rather than sent, and run() sends them together. Tm1Client.batch() offers the same with a client.

Each call through the view has its own result: that request's value, or its error, once the batch has run. One request's failure doesn't affect the others. A result is kept, so it can be waited for before or after run().

What TM1 (11.8) does here that you might not expect:

  • TM1 runs the requests one after another, in the order they joined: a later request sees what an earlier one wrote, and one that runs before a write doesn't see it. So a batch can create something and then read it back.
  • TM1 carries on past a failed request, and keeps what the others did. It refuses atomicityGroup and dependsOn, so one request can't refer to another's result. A call that sends a second request after the first answers (such as CellsetService.stream) can't join a batch: its second request comes after the run, and fails.
  • TM1 answers 200 for the batch even when every request in it failed: each failure is its request's own.
  • A thousand requests in one batch work; run(int) splits a bigger queue.
  • Raw bytes (document content) can't go in a JSON batch.

A request that requires something the server doesn't define is checked when the batch runs: its call fails with Tm1UnsupportedOperationException and it isn't sent, and the others still are.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    How many requests run() sends in each $batch.
  • Method Summary

    Modifier and Type
    Method
    Description
    reactor.core.publisher.Mono<Void>
    run()
    Sends the queued requests, 500 to a $batch.
    reactor.core.publisher.Mono<Void>
    run(int perRequest)
    Sends the queued requests, at most perRequest to each $batch, one $batch after another.
    The view whose requests join this batch.
    int
    How many requests have joined.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_PER_REQUEST

      public static final int DEFAULT_PER_REQUEST
      How many requests run() sends in each $batch.
      See Also:
  • Method Details

    • session

      public Tm1Session session()
      The view whose requests join this batch. A request is queued when the call is made, not when its result is subscribed to.
      Returns:
      the view
    • size

      public int size()
      How many requests have joined.
      Returns:
      the number
    • run

      public reactor.core.publisher.Mono<Void> run()
      Sends the queued requests, 500 to a $batch. A batch runs once; a call made through it afterwards fails.
      Returns:
      completes when every request has its result; fails only if it ran already
    • run

      public reactor.core.publisher.Mono<Void> run(int perRequest)
      Sends the queued requests, at most perRequest to each $batch, one $batch after another.
      Parameters:
      perRequest - the most requests in one $batch
      Returns:
      completes when every request has its result; fails only if it ran already
      Throws:
      IllegalArgumentException - if perRequest isn't positive