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

    Constructors
    Modifier
    Constructor
    Description
    protected
    BarrageSession(@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 Type
    Method
    Description
    io.deephaven.proto.DeephavenChannel
    The authenticated channel.
    of(@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 new BarrageSession for subscribing to Barrage tables.
    snapshot(@NotNull io.deephaven.client.impl.TableHandle tableHandle, @NotNull BarrageSnapshotOptions options)
    Create a new BarrageSnapshot based off the specified TableHandle object and options.
    snapshot(@NotNull io.deephaven.qst.table.TableSpec tableSpec, @NotNull BarrageSnapshotOptions options)
    Create a new BarrageSnapshot based off the specified QST TableSpec object and options.
    subscribe(@NotNull io.deephaven.client.impl.TableHandle tableHandle, @NotNull BarrageSubscriptionOptions options)
    Create a new BarrageSubscription based off the specified TableHandle object and options.
    subscribe(@NotNull io.deephaven.qst.table.TableSpec tableSpec, @NotNull BarrageSubscriptionOptions options)
    Create a new BarrageSubscription based off the specified QST TableSpec object 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 new BarrageSession for subscribing to Barrage tables. See SessionImplConfig.builder() and DeephavenTarget to help in the creation of the required SessionImpl
      Parameters:
      session - the underlying sessions to route messages to.
      incomingAllocator - the allocator for flight. Typically this is a RootAllocator
      channel - the managed gRPC channel for transport. See ChannelHelper
      Returns:
      A new BarrageSession for 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 new BarrageSubscription based off the specified QST TableSpec object and options. This method is a good way to create a complex table remotely.
      Specified by:
      subscribe in interface BarrageSubscription.Factory
      Parameters:
      tableSpec - the tableSpec to resolve and then subscribe to
      options - the options configuring the details of this subscription
      Returns:
      a new BarrageSubscription based on the input TableSpec
      Throws:
      io.deephaven.client.impl.TableHandle.TableHandleException
      InterruptedException
    • subscribe

      public BarrageSubscription subscribe(@NotNull @NotNull io.deephaven.client.impl.TableHandle tableHandle, @NotNull @NotNull BarrageSubscriptionOptions options)
      Create a new BarrageSubscription based off the specified TableHandle object and options. This method is a good way to create a complex table remotely.
      Specified by:
      subscribe in interface BarrageSubscription.Factory
      Parameters:
      tableHandle - the tableSpec to resolve and then subscribe to
      options - the options configuring the details of this subscription
      Returns:
      a new BarrageSubscription based on the input TableSpec
    • 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 new BarrageSnapshot based off the specified QST TableSpec object and options. This method is a good way to create a complex table remotely.
      Specified by:
      snapshot in interface BarrageSnapshot.Factory
      Parameters:
      tableSpec - the tableSpec to resolve and then subscribe to
      options - the options configuring the details of this subscription
      Returns:
      a new BarrageSnapshot based on the input TableSpec
      Throws:
      io.deephaven.client.impl.TableHandle.TableHandleException
      InterruptedException
    • snapshot

      public BarrageSnapshot snapshot(@NotNull @NotNull io.deephaven.client.impl.TableHandle tableHandle, @NotNull @NotNull BarrageSnapshotOptions options)
      Create a new BarrageSnapshot based off the specified TableHandle object and options. This method is a good way to create a complex table remotely.
      Specified by:
      snapshot in interface BarrageSnapshot.Factory
      Parameters:
      tableHandle - the tableSpec to resolve and then subscribe to
      options - the options configuring the details of this snapshot
      Returns:
      a new BarrageSnapshot based on the input TableSpec
    • channel

      public io.deephaven.proto.DeephavenChannel channel()
      The authenticated channel.
      Returns:
      the authenticated channel