ºìÁªLinuxÃÅ»§
Linux°ïÖú

Vert.x 3.5.0.Beta1·¢²¼£¬»ùÓÚJVMµÄNodeÌæ´úÕß

·¢²¼Ê±¼ä:2017-08-12 09:12:49À´Ô´:ºìÁª×÷Õß:baihuo
Vert.x 3.5.0.Beta1 ·¢²¼ÁË¡£Vert.x ÊÇÒ»¸öÓÃÓÚÏÂÒ»´úÒì²½¡¢¿ÉÉìËõ¡¢²¢·¢Ó¦ÓõĿò¼Ü£¬Ö¼ÔÚΪJVMÌṩһ¸öNode.jsµÄÌæ´ú·½°¸¡£¿ª·¢Õß¿ÉÒÔͨ¹ýËüʹÓÃJavaScript¡¢Ruby¡¢Groovy¡¢Java¡¢ÉõÖÁÊÇ»ìºÏÓïÑÔÀ´±àдӦÓá£
RxJava2

Ê×ÏÈ£¬´Ë°æ±¾ÌṩÁË RxJava2 API£¬Ö§³ÖÆäȫϵÁÐÀàÐÍ¡£

³ýÁË Single£¬Rxified API »¹ÓÐ Completable ºÍ Maybe ÀàÐÍ[code]// expose Handler>Completable completable = server.rxClose();

completable.subscribe(() -> System.out.println("closed"));

// expose Handler> where the result can be nullMaybe ipAddress = dnsClient.rxLookup("www.google.com");
ipAddress.subscribe(
value -> System.out.println("resolved to " + value),
err -> err.printStackTrace(),
() -> System.out.println("does not resolve"));[/code]RxJava ʹÓà toObservable() ·½·¨À´À©Õ¹ Vert.x Á÷£¬RxJava2 Ìí¼ÓÁË toFlowable() ·½·¨£º[code]// Flowable maps to a ReadStream// back-pressured streamFlowable flowable = asyncFile.toFlowable();// but we still can get an Observable// non back-pressured streamObservable flowable = asyncFile.toObservable();[/code]ÎĵµºÍʾÀý
MQTT Client

ÔÚ Vert.x 3.4 ÖУ¬ÎÒÃÇÌí¼ÓÁË MQTT ·þÎñÆ÷£¬3.5 ʹÓà MQTT ¿Í»§¶ËÍê³É MQTT ´úÀí£º[code]MqttClient mqttClient = MqttClient.create(vertx, new MqttClientOptions()
.setPort(BROKER_PORT)
.setHost(BROKER_HOST)).connect(ar -> if (ar.succeeded()) {
System.out.println("Connected to a server");

mqttClient.publish(
MQTT_TOPIC,
Buffer.buffer(MQTT_MESSAGE),
MqttQoS.AT_MOST_ONCE, false, false,
s -> mqttClient.disconnect(d -> System.out.println("Disconnected from server")));
} else {
System.out.println("Failed to connect to a server");
ar.cause().printStackTrace();
}
});[/code]¸üÐÂÄÚÈÝ£º

http://vertx.io/blog/vert-x-3-5-0-beta1/

ÏÂÔØµØÖ·£º

http://vertx.io/download/

Èí¼þÏêÇ飺https://github.com/vert-x3/vertx-examples/tree/3.5.0.beta1/mqtt-examples

À´×Ô:¿ªÔ´ÖйúÉçÇø
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ