hbc Streaming API 的 Java 客户端

程序名称:hbc

授权协议: Apache

操作系统: 跨平台

开发语言: Java

hbc 介绍

hbc (Hosebird Client)是Twitter Streaming API 的 Java 客户端开发包。

主要特性:

  • 支持GZip、OAuth和分块(partitioning);

  • 自动重新连接,并进行适当的backfill计数;

  • 访问原始字节的有效负载;

  • 适时重新分配,并进行相关统计。

包含了2个主要模块:

  • hbc-core:该模块使用了一个简单的消息队列,用户可以轮询消息。

  • hbc-twitter4j:该模块允许开发者在消息队列中使用Twitter4J项目和它的数据模型,以提供一个分析层。

示例代码:

ClientBuilder builder = new ClientBuilder()
  .name("Hosebird-Client-01")                              // optional: mainly for the logs
  .hosts(hosebirdHosts)
  .authentication(hosebirdAuth)
  .endpoint(hosebirdEndpoint)
  .processor(new StringDelimitedProcessor(msgQueue))
  .eventMessageQueue(eventQueue);                          // optional: use this if you want to process client events

Client hosebirdClient = builder.build();
// Attempts to establish a connection.
hosebirdClient.connect();

// on a different thread, or multiple different threads....
while (!client.isDone()) {
  String msg = msgQueue.take();
  something(msg);
  profit();
}

hosebirdClient.shutdown();

hbc 官网

https://github.com/twitter/hbc

相关编程语言

MuPlayer 是一款跨平台、轻量级的音频播放解决方案,...
OS FLV 是一个 开源和可嵌入网页的flv播放器。 这个...
DewPlayer音乐播放器,样式很简单,而且很实用.播放器...
JW FLV MEDIA PLAYER是一个开源的在网页上使用的Fla...
Speakker 是一个基于 Web 浏览器的音乐播放器,只提...
Player Framework 是一个开源的支持 HTML5 的视频播...