• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Server类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中io.moquette.server.Server的典型用法代码示例。如果您正苦于以下问题:Java Server类的具体用法?Java Server怎么用?Java Server使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Server类属于io.moquette.server包,在下文中一共展示了Server类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: startBroker

import io.moquette.server.Server; //导入依赖的package包/类
private Server startBroker(Server server, IConfig memoryConfig) {
	try {
		server.startServer(memoryConfig);
		return server;
	} catch (final IOException e) {
		throw propagate(e);
	}
}
 
开发者ID:Ardulink,项目名称:Ardulink-2,代码行数:9,代码来源:MqttBroker.java


示例2: start

import io.moquette.server.Server; //导入依赖的package包/类
@SuppressWarnings("ResultOfMethodCallIgnored")
@Override
public synchronized void start() throws Exception {
  long time = log(LOG, "start");
  File mqttServerDirectory = new File(ABS_DIR_MQTT);
  FileUtils.deleteDirectory(mqttServerDirectory);
  mqttServerDirectory.mkdirs();
  mqttServer = new Server();
  Properties mqttServerProperties = new Properties();
  mqttServerProperties.put(PERSISTENT_STORE_PROPERTY_NAME, ABS_DIR_MQTT + File.separatorChar + MQTT_BROKER_STORE_NAME);
  mqttServerProperties.put(PORT_PROPERTY_NAME, "" + MQTT_BROKER_PORT);
  mqttServer.startServer(new MemoryConfig(mqttServerProperties));
  log(LOG, "start", time);
}
 
开发者ID:ggear,项目名称:cloudera-framework,代码行数:15,代码来源:MqttServer.java


示例3: main

import io.moquette.server.Server; //导入依赖的package包/类
public static void main(String[] args) throws InterruptedException, IOException {
        IResourceLoader classpathLoader = new ClasspathResourceLoader();
        final IConfig classPathConfig = new ResourceLoaderConfig(classpathLoader);

        final Server mqttBroker = new Server();
        List<? extends InterceptHandler> userHandlers = Collections.singletonList(new PublisherListener());
        mqttBroker.startServer(classPathConfig, userHandlers);

        System.out.println("Broker started press [CTRL+C] to stop");
        //Bind  a shutdown hook
        Runtime.getRuntime().addShutdownHook(new Thread(() -> {
            System.out.println("Stopping broker");
            mqttBroker.stopServer();
            System.out.println("Broker stopped");
        }));

        Thread.sleep(20000);
        System.out.println("Before self publish");
        MqttPublishMessage message = MqttMessageBuilders.publish()
            .topicName("/exit")
            .retained(true)
//        qos(MqttQoS.AT_MOST_ONCE);
//        qQos(MqttQoS.AT_LEAST_ONCE);
            .qos(MqttQoS.EXACTLY_ONCE)
            .payload(Unpooled.copiedBuffer("Hello World!!".getBytes()))
            .build();

        mqttBroker.internalPublish(message, "INTRLPUB");
        System.out.println("After self publish");
    }
 
开发者ID:andsel,项目名称:moquette,代码行数:31,代码来源:EmbeddedLauncher.java


示例4: onStart

import io.moquette.server.Server; //导入依赖的package包/类
@Override
protected void onStart() throws PluginStartupException {

    // load topics from manifest file
    loadTopics();

    mqttBroker = new Server();
    Properties props = new Properties();

    // get properties from manifest file
    props.setProperty(BrokerConstants.PORT_PROPERTY_NAME, Integer.toString(BROKER_PORT));
    props.setProperty(BrokerConstants.HOST_PROPERTY_NAME, BROKER_HOST);

    props.setProperty(BrokerConstants.PASSWORD_FILE_PROPERTY_NAME, Info.PATHS.PATH_DEVICES_FOLDER + "/mqtt-broker/config/password_file.conf");
    props.setProperty(BrokerConstants.PERSISTENT_STORE_PROPERTY_NAME, Info.PATHS.PATH_DEVICES_FOLDER + "/mqtt-broker/config/moquette_store.mapdb");

    config = new MemoryConfig(props);
    userHandlers = asList(new PublisherListener());

    try {
        mqttBroker.startServer(config, userHandlers);
    } catch (IOException ex) {
        throw new PluginStartupException("Plugin can't start for an IOException.", ex);
    }
    setDescription("MQTT broker listening to " + config.getProperty(BrokerConstants.HOST_PROPERTY_NAME) + ":" + config.getProperty(BrokerConstants.PORT_PROPERTY_NAME));
    LOG.info("MQTT broker plugin started");
}
 
开发者ID:freedomotic,项目名称:freedomotic,代码行数:28,代码来源:MqttBroker.java


示例5: before

import io.moquette.server.Server; //导入依赖的package包/类
@Override
protected void before() throws IOException, InterruptedException {
	this.mqttServer = new Server();
	start();
}
 
开发者ID:Ardulink,项目名称:Ardulink-2,代码行数:6,代码来源:Broker.java


示例6: MqttBroker

import io.moquette.server.Server; //导入依赖的package包/类
public MqttBroker(final Builder builder) {
	config = new MemoryConfig(builder.properties());
	broker = startBroker(new Server(), config);
}
 
开发者ID:Ardulink,项目名称:Ardulink-2,代码行数:5,代码来源:MqttBroker.java


示例7: SimpleMqttBroker

import io.moquette.server.Server; //导入依赖的package包/类
public SimpleMqttBroker(String configPath) {
    config = new MqttConfiguration(configPath);
    mqttBroker = new Server();
}
 
开发者ID:iot-labs,项目名称:communication,代码行数:5,代码来源:SimpleMqttBroker.java


示例8: HazelcastInterceptHandler

import io.moquette.server.Server; //导入依赖的package包/类
public HazelcastInterceptHandler(Server server) {
    this.hz = server.getHazelcastInstance();
}
 
开发者ID:andsel,项目名称:moquette,代码行数:4,代码来源:HazelcastInterceptHandler.java


示例9: startServer

import io.moquette.server.Server; //导入依赖的package包/类
protected void startServer() throws IOException {
    m_server = new Server();
    m_server.startServer();
}
 
开发者ID:andsel,项目名称:moquette,代码行数:5,代码来源:ConnectionIT.java



注:本文中的io.moquette.server.Server类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Utils类代码示例发布时间:2022-05-23
下一篇:
Java InMemoryStatsStorage类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap