當前位置: 首頁>>代碼示例>>Java>>正文


Java Message.reply方法代碼示例

本文整理匯總了Java中org.vertx.java.core.eventbus.Message.reply方法的典型用法代碼示例。如果您正苦於以下問題:Java Message.reply方法的具體用法?Java Message.reply怎麽用?Java Message.reply使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.vertx.java.core.eventbus.Message的用法示例。


在下文中一共展示了Message.reply方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: sendResponse

import org.vertx.java.core.eventbus.Message; //導入方法依賴的package包/類
public boolean sendResponse(final Message<JsonObject> msg, final String status, final int statuscode, final String message, final String severity, final Object result) {
    boolean success = false;
    
    if (msg == null) {
        success = false;
    }
    else {
        JsonObject responseMsg = new JsonObject();
        responseMsg.putString(PROPERTY_MSG_STATUS, status);
        if (statuscode >= 100) responseMsg.putNumber(PROPERTY_MSG_STATUSCODE, statuscode);
        if (message != null) responseMsg.putString(PROPERTY_MSG_MESSAGE, message);
        if (severity != null) responseMsg.putString(PROPERTY_MSG_SEVERITY, severity);
        if (result != null) responseMsg.putValue(PROPERTY_MSG_RESULT, result);
        msg.reply(responseMsg);
        success = true;
    }
    
    return success;
}
 
開發者ID:santo74,項目名稱:vertx-arangodb,代碼行數:20,代碼來源:Helper.java

示例2: registerMethod

import org.vertx.java.core.eventbus.Message; //導入方法依賴的package包/類
public void registerMethod(String address, String method, boolean local)
		throws NoSuchMethodException, IllegalAccessException {
	final MethodHandle mh = lookup.bind(this, method,
			MethodType.methodType(void.class, Message.class));
	Handler<Message<JsonObject>> handler = new Handler<Message<JsonObject>>() {

		@Override
		public void handle(Message<JsonObject> message) {
			try {
				mh.invokeExact(message);
			} catch (Throwable e) {
				container.logger().error(e.getMessage(), e);
				JsonObject json = new JsonObject().putString("status", "error")
						.putString("message", e.getMessage());
				message.reply(json);
			}
		}
	};
	if (local) {
		Server.getEventBus(vertx).registerLocalHandler(busPrefix + address, handler);
	} else {
		Server.getEventBus(vertx).registerHandler(busPrefix + address, handler);
	}
}
 
開發者ID:web-education,項目名稱:web-utils,代碼行數:25,代碼來源:Controller.java

示例3: busApi

import org.vertx.java.core.eventbus.Message; //導入方法依賴的package包/類
@BusAddress("communityPages")
public void busApi(Message<JsonObject> message) {
	String action = message.body().getString("action", "");
	final String pageId = message.body().getString("pageId");
	switch (action) {
		case "create" :
			UserInfos user = UserUtils.sessionToUserInfos(message.body().getObject("user"));
			JsonObject page = message.body().getObject("page");
			crudService.create(page, user, busResponseHandler(message));
			break;
		case "share" :
			String userId = message.body().getString("userId");
			String groupId = message.body().getString("groupId");
			List<String> actions = message.body().getArray("actions").toList();
			shareService.groupShare(userId, groupId, pageId, actions, busResponseHandler(message));
			break;
		case "delete" :
			crudService.delete(pageId, busResponseHandler(message));
			break;
		case "get" :
			crudService.retrieve(pageId, busResponseHandler(message));
			break;
		case "update" :
			crudService.update(pageId, message.body().getObject("page"), busResponseHandler(message));
			break;
		default:
			message.reply(new JsonObject().putString("status", "error")
					.putString("message", "invalid.action"));
	}
}
 
開發者ID:OPEN-ENT-NG,項目名稱:community,代碼行數:31,代碼來源:PagesController.java

示例4: sendStatus

import org.vertx.java.core.eventbus.Message; //導入方法依賴的package包/類
public void sendStatus(String status, Message<JsonObject> message, JsonObject json) {
    if (json == null) {
        json = new JsonObject();
    }
    json.putString("status", status);
    message.reply(json);
}
 
開發者ID:bpark,項目名稱:vertx-pico-support,代碼行數:8,代碼來源:BusModContext.java

示例5: handle

import org.vertx.java.core.eventbus.Message; //導入方法依賴的package包/類
@Override
public void handle(Message event) {
	assertEquals(expectations.get("address"), event.address());
	assertTrue(sentObject.getClass().isInstance(event.body()));
	if (sentObject instanceof byte[]) {
		assertArrayEquals((byte[]) sentObject, (byte[]) event.body());
	} else {
		assertEquals(sentObject, event.body());
	}
	// echo back received message
	event.reply(event.body());
}
 
開發者ID:j2ro,項目名稱:mod-http-event-bus-bridge,代碼行數:13,代碼來源:MessageSendWithReplyHandler.java

示例6: findByName

import org.vertx.java.core.eventbus.Message; //導入方法依賴的package包/類
private void findByName(Message m) {
    final Parameter<String> params = gson.fromJson(m.body().toString(), Parameter.class);
    Logger logger = container.logger();

    m.reply(gson.toJson(repository.findEmployeeByFirstName(params.getValue("name"))));
    logger.info("reply to: " + m.body());
}
 
開發者ID:amoAHCP,項目名稱:vert.x-spring-microservice-demo,代碼行數:8,代碼來源:EmployeeService.java

示例7: getAll

import org.vertx.java.core.eventbus.Message; //導入方法依賴的package包/類
@Path("/employeeAll")
@OperationType(Type.REST_GET)
//@Produces("text/json")
public void getAll(Message m) {
    Logger logger = container.logger();
    m.reply(gson.toJson(repository.getAllEmployees()));
    logger.info("reply to: " + m.body());
}
 
開發者ID:amoAHCP,項目名稱:vert.x-spring-microservice-demo,代碼行數:9,代碼來源:EmployeeVerticleService.java

示例8: findByName

import org.vertx.java.core.eventbus.Message; //導入方法依賴的package包/類
@Path("/employeeByName")
// @Produces("text/json")
 @OperationType(Type.REST_GET)
 public void findByName(@QueryParam("name") String name, @QueryParam("lastname") String lastname, Message message) {
     Logger logger = container.logger();
     logger.info("parameter name: " + name + "  : " + lastname);
     message.reply(gson.toJson(repository.findEmployeeByFirstName(name)));
     logger.info("reply to: " + message.body());
 }
 
開發者ID:amoAHCP,項目名稱:vert.x-spring-microservice-demo,代碼行數:10,代碼來源:EmployeeVerticleService.java

示例9: execute

import org.vertx.java.core.eventbus.Message; //導入方法依賴的package包/類
@Override
public void execute(final Message message) {
    // Do nothing by default
    message.reply(RESULT_OK);
}
 
開發者ID:clidev,項目名稱:spike.x,代碼行數:6,代碼來源:Commands.java

示例10: execute

import org.vertx.java.core.eventbus.Message; //導入方法依賴的package包/類
@Override
public void execute(final Message message) {
    // Call verticle init method
    m_activator.initVerticle();
    message.reply(RESULT_OK);
}
 
開發者ID:clidev,項目名稱:spike.x,代碼行數:7,代碼來源:AbstractActivator.java

示例11: execute

import org.vertx.java.core.eventbus.Message; //導入方法依賴的package包/類
@Override
public void execute(final Message message) {
    m_logger.info("Command: {}", toJson());
    message.reply(resultOk());
}
 
開發者ID:clidev,項目名稱:spike.x,代碼行數:6,代碼來源:ActivatorTest.java

示例12: sendError

import org.vertx.java.core.eventbus.Message; //導入方法依賴的package包/類
public void sendError(Message<JsonObject> message, String error, Exception e) {
    logger.error(error, e);
    JsonObject json = new JsonObject().putString("status", "error").putString("message", error);
    message.reply(json);
}
 
開發者ID:bpark,項目名稱:vertx-pico-support,代碼行數:6,代碼來源:BusModContext.java

示例13: getServicesInfo

import org.vertx.java.core.eventbus.Message; //導入方法依賴的package包/類
private void getServicesInfo(Message<JsonObject> message) {
    final JsonArray all = new JsonArray();
    handlers.keySet().forEach(handler->all.addObject(new JsonObject(handler)));
    message.reply(new JsonObject().putArray("services",all));
}
 
開發者ID:amoAHCP,項目名稱:vert.x-spring-microservice-demo,代碼行數:6,代碼來源:ServiceRegistry.java

示例14: info

import org.vertx.java.core.eventbus.Message; //導入方法依賴的package包/類
private void info(Message m) {
    Logger logger = container.logger();

    m.reply(getServiceDescriptor());
    logger.info("reply to: " + m.body());
}
 
開發者ID:amoAHCP,項目名稱:vert.x-spring-microservice-demo,代碼行數:7,代碼來源:ServiceVerticle.java

示例15: getTestEmployeeOne

import org.vertx.java.core.eventbus.Message; //導入方法依賴的package包/類
@Path("/testEmployeeOne")
@OperationType(Type.REST_GET)
@Produces("application/json")
public void getTestEmployeeOne(@QueryParam("name") String name, @QueryParam("lastname") String lastname, Message message) {
    message.reply(name + ":" + lastname);
}
 
開發者ID:amoAHCP,項目名稱:vert.x-spring-microservice-demo,代碼行數:7,代碼來源:RESTGetVerticleService.java


注:本文中的org.vertx.java.core.eventbus.Message.reply方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。