Package cn.thinkingdata.analytics
Class TDBatchConsumer
- java.lang.Object
-
- cn.thinkingdata.analytics.TDBatchConsumer
-
- All Implemented Interfaces:
ITDConsumer
- Direct Known Subclasses:
BatchConsumer
public class TDBatchConsumer extends Object implements ITDConsumer
Data is reported using http
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTDBatchConsumer.ConfigBatchConsumer config
-
Constructor Summary
Constructors Modifier Constructor Description TDBatchConsumer(String serverUrl, String appId)Construct BatchConsumerprotectedTDBatchConsumer(String serverUrl, String appId, boolean isThrowException)Deprecated.protectedTDBatchConsumer(String serverUrl, String appId, int batchSize, int timeout, boolean autoFlush, int interval)Deprecated.protectedTDBatchConsumer(String serverUrl, String appId, int batchSize, int timeout, boolean autoFlush, int interval, String compress)Deprecated.protectedTDBatchConsumer(String serverUrl, String appId, int batchSize, int timeout, boolean autoFlush, int interval, String compress, int maxCacheSize, boolean isThrowException)Construct BatchConsumerTDBatchConsumer(String serverUrl, String appId, TDBatchConsumer.Config config)Construct BatchConsumer
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Map<String,Object> message)track eventvoidclose()close consumervoidflush()upload all data in buffer immediatelyvoidflushOnce()Flush data once.voidhttpSending(String data, int dataSize)Send data
-
-
-
Constructor Detail
-
TDBatchConsumer
public TDBatchConsumer(String serverUrl, String appId) throws URISyntaxException
Construct BatchConsumer- Parameters:
serverUrl- serverUrlappId- appId- Throws:
URISyntaxException- exception
-
TDBatchConsumer
public TDBatchConsumer(String serverUrl, String appId, TDBatchConsumer.Config config) throws URISyntaxException
Construct BatchConsumer- Parameters:
serverUrl- serverUrlappId- APP IDconfig- BatchConsumer config- Throws:
URISyntaxException- exception
-
TDBatchConsumer
@Deprecated protected TDBatchConsumer(String serverUrl, String appId, boolean isThrowException) throws URISyntaxException
Deprecated.Construct BatchConsumer- Parameters:
serverUrl- serverUrlappId- APP IDisThrowException- throw exception or not- Throws:
URISyntaxException- exception
-
TDBatchConsumer
@Deprecated protected TDBatchConsumer(String serverUrl, String appId, int batchSize, int timeout, boolean autoFlush, int interval) throws URISyntaxException
Deprecated.Construct BatchConsumer- Parameters:
serverUrl- serverUrlappId- APP IDbatchSize- flush event count each timetimeout- http timeout (Unit: mill second)autoFlush- is auto flush or notinterval- auto flush spacing (Unit: second)- Throws:
URISyntaxException- exception
-
TDBatchConsumer
@Deprecated protected TDBatchConsumer(String serverUrl, String appId, int batchSize, int timeout, boolean autoFlush, int interval, String compress) throws URISyntaxException
Deprecated.Construct BatchConsumer- Parameters:
serverUrl- serverUrlappId- APP IDbatchSize- flush event count each timetimeout- http timeout (Unit: mill second)autoFlush- is auto flush or notinterval- auto flush spacing (Unit: second)compress- compress type- Throws:
URISyntaxException- exception
-
TDBatchConsumer
protected TDBatchConsumer(String serverUrl, String appId, int batchSize, int timeout, boolean autoFlush, int interval, String compress, int maxCacheSize, boolean isThrowException) throws URISyntaxException
Construct BatchConsumer- Parameters:
serverUrl- serverUrlappId- APP IDbatchSize- flush event count each timetimeout- http timeout (Unit: mill second)autoFlush- is auto flush or notinterval- auto flush spacing (Unit: second)compress- compress typemaxCacheSize- max buffer countisThrowException- is throw exception or not- Throws:
URISyntaxException- exception
-
-
Method Detail
-
add
public void add(Map<String,Object> message)
Description copied from interface:ITDConsumertrack event- Specified by:
addin interfaceITDConsumer- Parameters:
message- event map
-
flush
public void flush()
Description copied from interface:ITDConsumerupload all data in buffer immediately- Specified by:
flushin interfaceITDConsumer
-
flushOnce
public void flushOnce()
Flush data once.
-
httpSending
public void httpSending(String data, int dataSize)
Send data- Parameters:
data- Event datadataSize- Data size
-
close
public void close()
Description copied from interface:ITDConsumerclose consumer- Specified by:
closein interfaceITDConsumer
-
-