Class SnowflakeStreamingIngestClientInternal<T>
- java.lang.Object
-
- net.snowflake.ingest.streaming.internal.SnowflakeStreamingIngestClientInternal<T>
-
- Type Parameters:
T- type of column data (ParquetChunkData)
- All Implemented Interfaces:
AutoCloseable,SnowflakeStreamingIngestClient
public class SnowflakeStreamingIngestClientInternal<T> extends Object implements SnowflakeStreamingIngestClient
The first version of implementation for SnowflakeStreamingIngestClient. The client internally manages a few things:- the channel cache, which contains all the channels that belong to this account
- the flush service, which schedules and coordinates the flush to Snowflake tables
-
-
Constructor Summary
Constructors Constructor Description SnowflakeStreamingIngestClientInternal(String name, SnowflakeURL accountURL, Properties prop, Map<String,Object> parameterOverrides, boolean isIcebergMode, boolean isTestMode)Default Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the client, which will flush first and then release all the resourcesvoiddropChannel(DropChannelRequest request)Drop the specified channel on the server using aDropChannelRequestMap<String,String>getLatestCommittedOffsetTokens(List<SnowflakeStreamingIngestChannel> channels)Return the latest committed/persisted offset token for all channelsStringgetName()Get the client namevoidinjectRequestBuilder(RequestBuilder requestBuilder)booleanisClosed()Check whether the client is closed or not, if you want to make sure all data are committed before closing, please callAutoCloseable.close()before closing the entire clientnet.snowflake.ingest.streaming.internal.SnowflakeStreamingIngestChannelInternal<?>openChannel(OpenChannelRequest request)Open a channel against a Snowflake tablevoidsetRefreshToken(String refreshToken)Set refresh token, this method is for refresh token renewal without requiring to restart client.
-
-
-
Constructor Detail
-
SnowflakeStreamingIngestClientInternal
public SnowflakeStreamingIngestClientInternal(String name, SnowflakeURL accountURL, Properties prop, Map<String,Object> parameterOverrides, boolean isIcebergMode, boolean isTestMode)
Default Constructor- Parameters:
name- the name of the clientaccountURL- Snowflake account urlprop- connection propertiesparameterOverrides- map of parameters to override for this clientisIcebergMode- whether we're streaming to Iceberg tablesisTestMode- indicates whether it's under test mode
-
-
Method Detail
-
injectRequestBuilder
public void injectRequestBuilder(RequestBuilder requestBuilder)
-
getName
public String getName()
Get the client name- Specified by:
getNamein interfaceSnowflakeStreamingIngestClient- Returns:
- the client name
-
isClosed
public boolean isClosed()
Description copied from interface:SnowflakeStreamingIngestClientCheck whether the client is closed or not, if you want to make sure all data are committed before closing, please callAutoCloseable.close()before closing the entire client- Specified by:
isClosedin interfaceSnowflakeStreamingIngestClient- Returns:
- a boolean to indicate whether the client is closed or not
-
openChannel
public net.snowflake.ingest.streaming.internal.SnowflakeStreamingIngestChannelInternal<?> openChannel(OpenChannelRequest request)
Open a channel against a Snowflake table- Specified by:
openChannelin interfaceSnowflakeStreamingIngestClient- Parameters:
request- the open channel request- Returns:
- a SnowflakeStreamingIngestChannel object
-
dropChannel
public void dropChannel(DropChannelRequest request)
Description copied from interface:SnowflakeStreamingIngestClientDrop the specified channel on the server using aDropChannelRequestNote that this call will blindly drop the latest version of the channel and any pending data will be lost. It will also delete Offset Token and other state from Snowflake servers. So only use it if you are completely done ingesting data for this channel. If you open a channel with the same name in the future, it will behave like a new channel.
Also see
SnowflakeStreamingIngestChannel.close(boolean)to drop channels on close. That approach will drop the local version of the channel and if the channel has been concurrently reopened by another client, that version of the channel won't be affected.- Specified by:
dropChannelin interfaceSnowflakeStreamingIngestClient- Parameters:
request- the drop channel request
-
getLatestCommittedOffsetTokens
public Map<String,String> getLatestCommittedOffsetTokens(List<SnowflakeStreamingIngestChannel> channels)
Return the latest committed/persisted offset token for all channels- Specified by:
getLatestCommittedOffsetTokensin interfaceSnowflakeStreamingIngestClient- Returns:
- map of channel to the latest persisted offset token
-
close
public void close() throws ExceptionClose the client, which will flush first and then release all the resources- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
setRefreshToken
public void setRefreshToken(String refreshToken)
Set refresh token, this method is for refresh token renewal without requiring to restart client. This method only works when the authorization type is OAuth- Specified by:
setRefreshTokenin interfaceSnowflakeStreamingIngestClient- Parameters:
refreshToken- the new refresh token
-
-