Package io.deephaven.client.impl
Class BarrageSession
java.lang.Object
io.deephaven.client.impl.FlightSession
io.deephaven.client.impl.BarrageSession
- All Implemented Interfaces:
BarrageSnapshot.Factory,BarrageSubscription.Factory,AutoCloseable
public class BarrageSession
extends io.deephaven.client.impl.FlightSession
implements BarrageSubscription.Factory, BarrageSnapshot.Factory
An extension of an Arrow FlightSession adding support for Barrage Snapshots and Subscriptions.
In order to subscribe using BarrageSession directly, you need to construct a SessionImpl, a
ManagedChannel, a ClientConfig and initially, a DeephavenTarget.
The SessionImpl represents a flight session over a specified gRPC channel (the ManagedChannel, uising
the connection parameters specified by the ClientConfig and DeephavenTarget.
import io.deephaven.client.impl.*
import io.deephaven.proto.DeephavenChannel
import io.deephaven.qst.table.TicketTable
import io.deephaven.uri.DeephavenTarget
import io.grpc.ManagedChannel
import org.apache.arrow.memory.BufferAllocator
import org.apache.arrow.memory.RootAllocator
import io.deephaven.barrage.BarrageSubscriptionOptions
import java.util.concurrent.Executors
import java.util.concurrent.ScheduledExecutorService
final BufferAllocator bufferAllocator = new RootAllocator()
final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(4)
DeephavenTarget dt = DeephavenTarget.builder()
.host("my.server.com")
.port(8888)
.isSecure(true)
.build()
ClientConfig cc = ClientConfig.builder()
.target(dt)
.build()
ManagedChannel managedChannel = ChannelHelper.channel(cc)
SessionImpl si = SessionImplConfig.builder()
.executor(scheduler)
.channel(new DeephavenChannel(managedChannel))
.build()
.createSession()
BarrageSession session = BarrageSession.of(si, bufferAllocator, managedChannel);
Table marketData = session.subscribe(TicketTable.of("s/MarketData"), BarrageSubscriptionOptions.builder().build())
-
Field Summary
Fields inherited from class io.deephaven.client.impl.FlightSession
client, session -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBarrageSession(@NotNull io.deephaven.client.impl.SessionImpl session, @NotNull io.deephaven.shadow.client.flight.org.apache.arrow.flight.FlightClient client, @NotNull io.deephaven.shadow.client.flight.io.grpc.ManagedChannel channel) -
Method Summary
Modifier and TypeMethodDescriptionio.deephaven.proto.DeephavenChannelchannel()The authenticated channel.static BarrageSessionof(@NotNull io.deephaven.client.impl.SessionImpl session, @NotNull io.deephaven.shadow.client.flight.org.apache.arrow.memory.BufferAllocator incomingAllocator, @NotNull io.deephaven.shadow.client.flight.io.grpc.ManagedChannel channel) Create a newBarrageSessionfor subscribing to Barrage tables.snapshot(@NotNull io.deephaven.client.impl.TableHandle tableHandle, @NotNull BarrageSnapshotOptions options) Create a newBarrageSnapshotbased off the specifiedTableHandleobject and options.snapshot(@NotNull io.deephaven.qst.table.TableSpec tableSpec, @NotNull BarrageSnapshotOptions options) Create a newBarrageSnapshotbased off the specified QSTTableSpecobject and options.subscribe(@NotNull io.deephaven.client.impl.TableHandle tableHandle, @NotNull BarrageSubscriptionOptions options) Create a newBarrageSubscriptionbased off the specifiedTableHandleobject and options.subscribe(@NotNull io.deephaven.qst.table.TableSpec tableSpec, @NotNull BarrageSubscriptionOptions options) Create a newBarrageSubscriptionbased off the specified QSTTableSpecobject and options.Methods inherited from class io.deephaven.client.impl.FlightSession
addToInputTable, addToInputTable, close, deleteFromInputTable, deleteFromInputTable, getClient, list, put, put, putExport, putExport, putExportManual, putExportManual, release, schema, schema, session, startExchange, startExchange, stream
-
Constructor Details
-
BarrageSession
protected BarrageSession(@NotNull @NotNull io.deephaven.client.impl.SessionImpl session, @NotNull @NotNull io.deephaven.shadow.client.flight.org.apache.arrow.flight.FlightClient client, @NotNull @NotNull io.deephaven.shadow.client.flight.io.grpc.ManagedChannel channel)
-
-
Method Details
-
of
public static BarrageSession of(@NotNull @NotNull io.deephaven.client.impl.SessionImpl session, @NotNull @NotNull io.deephaven.shadow.client.flight.org.apache.arrow.memory.BufferAllocator incomingAllocator, @NotNull @NotNull io.deephaven.shadow.client.flight.io.grpc.ManagedChannel channel) Create a newBarrageSessionfor subscribing to Barrage tables. SeeSessionImplConfig.builder()andDeephavenTargetto help in the creation of the requiredSessionImpl- Parameters:
session- the underlying sessions to route messages to.incomingAllocator- the allocator for flight. Typically this is aRootAllocatorchannel- the managed gRPC channel for transport. SeeChannelHelper- Returns:
- A new
BarrageSessionfor subscriptions.
-
subscribe
public BarrageSubscription subscribe(@NotNull @NotNull io.deephaven.qst.table.TableSpec tableSpec, @NotNull @NotNull BarrageSubscriptionOptions options) throws io.deephaven.client.impl.TableHandle.TableHandleException, InterruptedException Create a newBarrageSubscriptionbased off the specified QSTTableSpecobject and options. This method is a good way to create a complex table remotely.- Specified by:
subscribein interfaceBarrageSubscription.Factory- Parameters:
tableSpec- the tableSpec to resolve and then subscribe tooptions- the options configuring the details of this subscription- Returns:
- a new
BarrageSubscriptionbased on the inputTableSpec - Throws:
io.deephaven.client.impl.TableHandle.TableHandleExceptionInterruptedException
-
subscribe
public BarrageSubscription subscribe(@NotNull @NotNull io.deephaven.client.impl.TableHandle tableHandle, @NotNull @NotNull BarrageSubscriptionOptions options) Create a newBarrageSubscriptionbased off the specifiedTableHandleobject and options. This method is a good way to create a complex table remotely.- Specified by:
subscribein interfaceBarrageSubscription.Factory- Parameters:
tableHandle- the tableSpec to resolve and then subscribe tooptions- the options configuring the details of this subscription- Returns:
- a new
BarrageSubscriptionbased on the inputTableSpec
-
snapshot
public BarrageSnapshot snapshot(@NotNull @NotNull io.deephaven.qst.table.TableSpec tableSpec, @NotNull @NotNull BarrageSnapshotOptions options) throws io.deephaven.client.impl.TableHandle.TableHandleException, InterruptedException Create a newBarrageSnapshotbased off the specified QSTTableSpecobject and options. This method is a good way to create a complex table remotely.- Specified by:
snapshotin interfaceBarrageSnapshot.Factory- Parameters:
tableSpec- the tableSpec to resolve and then subscribe tooptions- the options configuring the details of this subscription- Returns:
- a new
BarrageSnapshotbased on the inputTableSpec - Throws:
io.deephaven.client.impl.TableHandle.TableHandleExceptionInterruptedException
-
snapshot
public BarrageSnapshot snapshot(@NotNull @NotNull io.deephaven.client.impl.TableHandle tableHandle, @NotNull @NotNull BarrageSnapshotOptions options) Create a newBarrageSnapshotbased off the specifiedTableHandleobject and options. This method is a good way to create a complex table remotely.- Specified by:
snapshotin interfaceBarrageSnapshot.Factory- Parameters:
tableHandle- the tableSpec to resolve and then subscribe tooptions- the options configuring the details of this snapshot- Returns:
- a new
BarrageSnapshotbased on the inputTableSpec
-
channel
public io.deephaven.proto.DeephavenChannel channel()The authenticated channel.- Returns:
- the authenticated channel
-