我正在尝试使用XPUB和XSUB来实现,如下图所示。我已经仔细阅读了所提供的示例,但在Java中无法获得XPUB和XSUB的示例。在这里,他们给出了一个用C编写的示例,该示例有点复杂,因为我是ZeroMQ的新手。
我正在尝试使用jni包装版本在android中使用它。请帮助我找到一个示例,说明如何使用Java在ZeroMQ中使用代理实现此Pub-Sub网络。
目前,我指的是http://zguide.zeromq.org/page:all
我尝试将其移植如下。 Subscriber.java
公共类订户扩展了线程实现Runnable {
private static final String TAG = "Subscriber";
private Context ctx;
public Subscriber(ZMQ.Context z_context) {
this.ctx = z_context;
}
@Override
public void run() {
super.run();
ZMQ.Socket mulServiceSubscriber = ctx.socket(ZMQ.SUB);
mulServiceSubscriber.connect("tcp://localhost:6001");
mulServiceSubscriber.subscribe("A".getBytes());
mulServiceSubscriber.subscribe("B".getBytes());
while (true) {
Log.d(TAG, "Subscriber loop started..");
String content = new String(mulServiceSubscriber.recv(0));
Log.d(TAG, "Subscriber Received : "+content);
}
}
Run Code Online (Sandbox Code Playgroud)
}
Publisher.java
公共类Publisher扩展了Thread实现Runnable {
private static final String TAG = "Publisher";
private Context ctx; …
Run Code Online (Sandbox Code Playgroud) 用户已通过引荐来源链接安装了应用并安装了应用.
当用户再次点击相同的引荐来源链接时,它会使用打开选项导航到PlayStore.Google Analytics广告系列referring traffic sources or marketing campaigns may be attributed to user activity in subsequent sessions在一般广告系列和流量来源归因下所说的文档
当用户通过从PlayStore中选择打开选项来启动应用程序时,我尝试根据以下文档从意图中捕获引荐来源,
Intent intent = this.getIntent();
Uri uri = intent.getData();
Run Code Online (Sandbox Code Playgroud)
uri本身是空的.如何知道用户是否第一次从PlayStore打开应用程序.