Package net.snowflake.ingest.streaming
Interface SnowflakeStreamingIngestClient
-
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
SnowflakeStreamingIngestClientInternal
public interface SnowflakeStreamingIngestClient extends AutoCloseable
A class that is the starting point for using the Streaming Ingest client APIs, a single client maps to exactly one account in Snowflake; however, multiple clients can point to the same account. Each client will contain information for Snowflake authentication and authorization, and it will be used to create one or moreSnowflakeStreamingIngestChannel
Thread safety note: Implementations of this interface are required to be thread safe.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
dropChannel(DropChannelRequest request)
Drop the specified channel on the server using aDropChannelRequest
Map<String,String>
getLatestCommittedOffsetTokens(List<SnowflakeStreamingIngestChannel> channels)
Return the latest committed offset token for a list of channelsString
getName()
Get the client nameboolean
isClosed()
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 clientSnowflakeStreamingIngestChannel
openChannel(OpenChannelRequest request)
Open a channel against a Snowflake table using aOpenChannelRequest
void
setRefreshToken(String refreshToken)
Set refresh token, this method is for refresh token renewal without requiring to restart client.-
Methods inherited from interface java.lang.AutoCloseable
close
-
-
-
-
Method Detail
-
openChannel
SnowflakeStreamingIngestChannel openChannel(OpenChannelRequest request)
Open a channel against a Snowflake table using aOpenChannelRequest
- Parameters:
request
- the open channel request- Returns:
- a
SnowflakeStreamingIngestChannel
object
-
dropChannel
void dropChannel(DropChannelRequest request)
Drop the specified channel on the server using aDropChannelRequest
Note 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.- Parameters:
request
- the drop channel request
-
getName
String getName()
Get the client name- Returns:
- the client name
-
setRefreshToken
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.- Parameters:
refreshToken
- the new refresh token
-
isClosed
boolean isClosed()
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 client- Returns:
- a boolean to indicate whether the client is closed
-
getLatestCommittedOffsetTokens
Map<String,String> getLatestCommittedOffsetTokens(List<SnowflakeStreamingIngestChannel> channels)
Return the latest committed offset token for a list of channels- Returns:
- a map of channel fully qualified name to latest committed offset token
-
-