skipcheck

TM1 client · Docs · Sessions and logins

Tm1SessionBatch

using Skipcheck.Tm1.Client.Session;

A JSON $batch being put together: Session is a view of the session whose requests are queued rather than sent, and RunAsync 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 RunAsync.

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.StreamAsync) 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; RunAsync 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.

Members

DefaultPerRequest staticThe most requests RunAsync sends in one $batch.
Session propertyThe view whose requests join this batch.
SizeHow many requests have joined.
RunAsyncSends the queued requests, at most DefaultPerRequest to each $batch; completes when every call has its result.
RunAsyncSends the queued requests, at most perRequest to each $batch.

DefaultPerRequest

static
const int DefaultPerRequest

The most requests RunAsync sends in one $batch.

Session

property
Tm1Session Session

The view whose requests join this batch.

Size

int Size()

How many requests have joined.

RunAsync

Task RunAsync(CancellationToken cancellationToken = default)

Sends the queued requests, at most DefaultPerRequest to each $batch; completes when every call has its result.

RunAsync

Task RunAsync(int perRequest, CancellationToken cancellationToken = default)

Sends the queued requests, at most perRequest to each $batch.