com.couchbase.client
Class TapClient

java.lang.Object
  extended by net.spy.memcached.TapClient
      extended by com.couchbase.client.TapClient

public class TapClient
extends net.spy.memcached.TapClient

A tap client for Couchbase server.


Field Summary
 
Fields inherited from class net.spy.memcached.TapClient
messagesRead, omap, rqueue
 
Constructor Summary
TapClient(java.util.List<java.net.URI> baseList, java.lang.String bucketName, java.lang.String pwd)
          Creates a cluster aware tap client for Couchbase Server.
 
Method Summary
 long getMessagesRead()
          The number of messages read by all of the tap streams created with this client.
 net.spy.memcached.tapmessage.ResponseMessage getNextMessage()
          Gets the next tap message from the queue of received tap messages.
 net.spy.memcached.tapmessage.ResponseMessage getNextMessage(long time, java.util.concurrent.TimeUnit timeunit)
          Gets the next tap message from the queue of received tap messages.
 boolean hasMoreMessages()
          Decides whether the client has received tap messages or will receive more messages in the future.
 void shutdown()
          Shuts down all tap streams that are currently running.
 net.spy.memcached.tapmessage.TapStream tapBackfill(java.lang.String id, int runTime, java.util.concurrent.TimeUnit timeunit)
          Specifies a tap stream that will send all key-value mutations that take place in the future.
 net.spy.memcached.tapmessage.TapStream tapBackfill(java.lang.String id, long date, int runTime, java.util.concurrent.TimeUnit timeunit)
          Specifies a tap stream that will send all key-value mutations that took place after a specific date.
 net.spy.memcached.tapmessage.TapStream tapCustom(java.lang.String id, net.spy.memcached.tapmessage.RequestMessage message)
          Allows the user to specify a custom tap message.
 net.spy.memcached.tapmessage.TapStream tapDump(java.lang.String id)
          Specifies a tap stream that will take a snapshot of items in Couchbase and send them through a tap stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TapClient

public TapClient(java.util.List<java.net.URI> baseList,
                 java.lang.String bucketName,
                 java.lang.String pwd)
Creates a cluster aware tap client for Couchbase Server. This type of TapClient will TAP all servers in the specified cluster and will react to changes in the number of cluster nodes.

Parameters:
baseList - a list of servers to get the cluster configuration from.
bucketName - the name of the bucket to tap.
pwd - the buckets password.
Method Detail

getNextMessage

public net.spy.memcached.tapmessage.ResponseMessage getNextMessage()
Gets the next tap message from the queue of received tap messages.

Overrides:
getNextMessage in class net.spy.memcached.TapClient
Returns:
The tap message at the head of the queue or null if the queue is empty for more than one second.

getNextMessage

public net.spy.memcached.tapmessage.ResponseMessage getNextMessage(long time,
                                                                   java.util.concurrent.TimeUnit timeunit)
Gets the next tap message from the queue of received tap messages.

Overrides:
getNextMessage in class net.spy.memcached.TapClient
Parameters:
time - the amount of time to wait for a message.
timeunit - the unit of time to use.
Returns:
The tap message at the head of the queue or null if the queue is empty for the given amount of time.

hasMoreMessages

public boolean hasMoreMessages()
Decides whether the client has received tap messages or will receive more messages in the future.

Overrides:
hasMoreMessages in class net.spy.memcached.TapClient
Returns:
true if the client has tap responses or expects to have responses in the future. False otherwise.

tapCustom

public net.spy.memcached.tapmessage.TapStream tapCustom(java.lang.String id,
                                                        net.spy.memcached.tapmessage.RequestMessage message)
                                                 throws javax.naming.ConfigurationException,
                                                        java.io.IOException
Allows the user to specify a custom tap message. This API for TAP is still evolving, and only recommended for advanced usage. See http://www.couchbase.com/wiki/display/couchbase/TAP+Protocol

Overrides:
tapCustom in class net.spy.memcached.TapClient
Parameters:
id - the named tap id that can be used to resume a disconnected tap stream
message - the custom tap message that will be used to initiate the tap stream.
Returns:
the operation that controls the tap stream.
Throws:
javax.naming.ConfigurationException - a bad configuration was received from the Couchbase cluster.
java.io.IOException - if there are errors connecting to the cluster.

tapBackfill

public net.spy.memcached.tapmessage.TapStream tapBackfill(java.lang.String id,
                                                          int runTime,
                                                          java.util.concurrent.TimeUnit timeunit)
                                                   throws java.io.IOException,
                                                          javax.naming.ConfigurationException
Specifies a tap stream that will send all key-value mutations that take place in the future.

Parameters:
id - the named tap id that can be used to resume a disconnected tap stream
runTime - the amount of time to do backfill for. Set to 0 for infinite backfill.
timeunit - the unit of time for the runtime parameter.
Returns:
the operation that controls the tap stream.
Throws:
javax.naming.ConfigurationException - a bad configuration was received from the Couchbase cluster.
java.io.IOException - If there are errors connecting to the cluster.

tapBackfill

public net.spy.memcached.tapmessage.TapStream tapBackfill(java.lang.String id,
                                                          long date,
                                                          int runTime,
                                                          java.util.concurrent.TimeUnit timeunit)
                                                   throws java.io.IOException,
                                                          javax.naming.ConfigurationException
Specifies a tap stream that will send all key-value mutations that took place after a specific date.

Parameters:
id - the named tap id that can be used to resume a disconnected tap stream
date - the date to begin sending key mutations from. Specify -1 to send all future key-value mutations.
runTime - the amount of time to do backfill for. Set to 0 for infinite backfill.
timeunit - the unit of time for the runtime parameter.
Returns:
the operation that controls the tap stream.
Throws:
javax.naming.ConfigurationException - a bad configuration was received from the Couchbase cluster.
java.io.IOException - If there are errors connecting to the cluster.

tapDump

public net.spy.memcached.tapmessage.TapStream tapDump(java.lang.String id)
                                               throws java.io.IOException,
                                                      javax.naming.ConfigurationException
Specifies a tap stream that will take a snapshot of items in Couchbase and send them through a tap stream.

Overrides:
tapDump in class net.spy.memcached.TapClient
Parameters:
id - the named tap id that can be used to resume a disconnected tap stream
Returns:
the operation that controls the tap stream.
Throws:
javax.naming.ConfigurationException - a bad configuration was received from the Couchbase cluster.
java.io.IOException - If there are errors connecting to the cluster.

shutdown

public void shutdown()
Shuts down all tap streams that are currently running.

Overrides:
shutdown in class net.spy.memcached.TapClient

getMessagesRead

public long getMessagesRead()
The number of messages read by all of the tap streams created with this client. This will include a count of all tap response types.

Overrides:
getMessagesRead in class net.spy.memcached.TapClient
Returns:
The number of messages read


Copyright © 2006-2009 Dustin Sallings, 2009-2012 Couchbase, Inc.