当前位置: 首页>>代码示例>>Java>>正文


Java ServerMessage.Mutable方法代码示例

本文整理汇总了Java中org.cometd.bayeux.server.ServerMessage.Mutable方法的典型用法代码示例。如果您正苦于以下问题:Java ServerMessage.Mutable方法的具体用法?Java ServerMessage.Mutable怎么用?Java ServerMessage.Mutable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.cometd.bayeux.server.ServerMessage的用法示例。


在下文中一共展示了ServerMessage.Mutable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sub

import org.cometd.bayeux.server.ServerMessage; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public synchronized void sub(ServerMessage.Mutable message) {
	Map<String, ?> map = (Map<String, ?>)message.getData();
	if (closed) {
		log.warn("sub[session=" + remote.getId() + "] ignored closed session: " + map);
		return;
	}
	if (log.debugEnabled())
		log.debug("sub[session=" + remote.getId() + "]: " + map);
	Boolean reset = (Boolean)map.get("reset");
	if (reset != null && reset)
		resetSub();
	processSub(false, false, (Map<String, List<?>>)map.get("remove"));
	processSub(true, false, (Map<String, List<?>>)map.get("add"));
	processSub(false, true, (Map<String, List<?>>)map.get("removeTimeSeries"));
	processSub(true, true, (Map<String, List<?>>)map.get("addTimeSeries"));

	stats.regSubscription(
		regularSubscriptionsMap.values().stream().mapToInt(sub -> sub.getSymbols().size()).sum(), false);
	stats.regSubscription(
		timeSeriesSubscriptionsMap.values().stream().mapToInt(sub -> sub.getSymbols().size()).sum(), true);
}
 
开发者ID:Devexperts,项目名称:QD,代码行数:23,代码来源:DataService.java

示例2: push

import org.cometd.bayeux.server.ServerMessage; //导入方法依赖的package包/类
public void push(ServerSession remote, ServerMessage cometdMessage) throws Exception {
    Object data = null;

    Message message = binding.createCamelMessage(remote, cometdMessage, data);

    Exchange exchange = endpoint.createExchange();
    exchange.setIn(message);

    consumer.getProcessor().process(exchange);

    if (ExchangeHelper.isOutCapable(exchange)) {
        ServerChannel channel = getBayeux().getChannel(channelName);
        ServerSession serverSession = getServerSession();

        ServerMessage.Mutable outMessage = binding.createCometdMessage(channel, serverSession, exchange.getOut());
        remote.deliver(serverSession, outMessage);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:CometdConsumer.java

示例3: process

import org.cometd.bayeux.server.ServerMessage; //导入方法依赖的package包/类
public void process(final Exchange exchange) {
    String channelName = producer.getEndpoint().getPath();
    BayeuxServerImpl bayeux = producer.getBayeux();
    ServerChannel channel = bayeux.getChannel(channelName);
    ServerSession serverSession = getServerSession();

    try {
        if (channel != null) {
            logDelivery(exchange, channel);
            ServerMessage.Mutable mutable = binding.createCometdMessage(channel, serverSession,
                                                                        exchange.getIn());
            channel.publish(serverSession, mutable);
        }
    } finally {
        if (disconnectLocalSession && serverSession.isLocalSession()) {
            LOG.trace("Disconnection local session {}", serverSession);
            serverSession.disconnect();
        }
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:CometdProducer.java

示例4: parse

import org.cometd.bayeux.server.ServerMessage; //导入方法依赖的package包/类
@Override
public ServerMessage.Mutable[] parse(InputStream stream) throws ParseException {
	try {
		return DXFeedJson.MAPPER.readValue(stream, VALUE_TYPE);
	} catch (IOException e) {
		throw (ParseException)new ParseException("", -1).initCause(e);
	}
}
 
开发者ID:Devexperts,项目名称:QD,代码行数:9,代码来源:DataJsonContext.java

示例5: onDemand

import org.cometd.bayeux.server.ServerMessage; //导入方法依赖的package包/类
@Listener("/service/onDemand")
public void onDemand(ServerSession remote, ServerMessage.Mutable message) {
	Map<String, Object> map = message.getDataAsMap();
	String op = (String)map.get("op");
	List<?> rawArgs = (List<?>)map.get("args");
	Method method = ONDEMAND_OPS.get(op);
	if (method == null)
		throw new IllegalArgumentException("Unsupported ondemand operation: " + op);
	try {
		invokeMethod(remote, method, rawArgs);
	} catch (Exception e) {
		throw new RuntimeException("Failed to invoke onDemand." + op + " with " + rawArgs, e);
	}
}
 
开发者ID:Devexperts,项目名称:QD,代码行数:15,代码来源:DataService.java

示例6: rcv

import org.cometd.bayeux.server.ServerMessage; //导入方法依赖的package包/类
@Override
public boolean rcv(ServerSession session, ServerMessage.Mutable message) {
	if (message instanceof DataMessage) {
		stats.readEvents += ((DataMessage)message).getEvents().size();
	}
	stats.lastActiveTime = System.currentTimeMillis();
	stats.read++;
	return true;
}
 
开发者ID:Devexperts,项目名称:QD,代码行数:10,代码来源:DataService.java

示例7: createCometdMessage

import org.cometd.bayeux.server.ServerMessage; //导入方法依赖的package包/类
public ServerMessage.Mutable createCometdMessage(ServerChannel channel, ServerSession serverSession, Message camelMessage) {
    ServerMessage.Mutable mutable = bayeux.newMessage();
    mutable.setChannel(channel.getId());

    if (serverSession != null) {
        mutable.setClientId(serverSession.getId());
    }
    addHeadersToMessage(mutable, camelMessage);
    mutable.setData(camelMessage.getBody());
    return mutable;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:12,代码来源:CometdBinding.java

示例8: sendMeta

import org.cometd.bayeux.server.ServerMessage; //导入方法依赖的package包/类
public boolean sendMeta(ServerSession to, ServerMessage.Mutable message) {
    if (Channel.META_HANDSHAKE.equals(message.getChannel())) {
        if (!message.isSuccessful()) {
            Map<String, Object> advice = message.getAdvice(true);
            advice.put(Message.RECONNECT_FIELD, Message.RECONNECT_HANDSHAKE_VALUE);

            Map<String, Object> ext = message.getExt(true);
            Map<String, Object> authentication = new HashMap<String, Object>();
            ext.put("authentication", authentication);
            authentication.put("failed", true);
            authentication.put("failureReason", "invalid_credentials");
        }
    }
    return true;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:16,代码来源:CometdProducerConsumerInteractiveAuthenticatedMain.java

示例9: join

import org.cometd.bayeux.server.ServerMessage; //导入方法依赖的package包/类
@Listener("/service/join/*")
  public void join(ServerSession remote, ServerMessage.Mutable message) {
  	JoinRequest joinRequest = new JoinRequest(remote, message);
LOGGER.info(String.format("Client %s on behalf of %s is requesting to join %s.",joinRequest.getRequesterId(), getCurrentParticipant(), joinRequest.getCollaborationId()));
try {
	server.joinClient(joinRequest.getRequesterId(), getCurrentParticipant(), joinRequest.getCollaborationId());
	remote.addListener(this);
} catch (ServerException e) {
	LOGGER.error(String.format("Joining collaboration has failed: %s",e.getMessage()));
}
  }
 
开发者ID:HotblackDesiato,项目名称:collabware,代码行数:12,代码来源:CometdProtocolEndpoint.java

示例10: applyClientChange

import org.cometd.bayeux.server.ServerMessage; //导入方法依赖的package包/类
@Listener("/service/clientChange/*")
  public void applyClientChange(ServerSession remote, ServerMessage.Mutable message) {
try {
	ChangeRequest change = new ChangeRequest(remote, message, this.operationsProvider);
	LOGGER.info(String.format("Applying change by client %s on behalf of %s to collaboration %s: %s", change.getRequesterId(), getCurrentParticipant(), change.getCollaborationId(), change.getOperation()));
	server.applyClientChange(change.getRequesterId(), change.getCollaborationId(), change.getOperation(), change.getClientSequenceNumber(), change.getServerSequenceNumber());
} catch (Exception e) {
	LOGGER.error("Error while applying client change ",e);
	LOGGER.error("Disconnecting client");
	remote.disconnect();
   }
  }
 
开发者ID:HotblackDesiato,项目名称:collabware,代码行数:13,代码来源:CometdProtocolEndpoint.java

示例11: generate

import org.cometd.bayeux.server.ServerMessage; //导入方法依赖的package包/类
@Override
public String generate(ServerMessage.Mutable mutable) {
	return generate((Object)mutable);
}
 
开发者ID:Devexperts,项目名称:QD,代码行数:5,代码来源:DataJsonContext.java

示例12: rcvMeta

import org.cometd.bayeux.server.ServerMessage; //导入方法依赖的package包/类
@Override
public boolean rcvMeta(ServerSession session, ServerMessage.Mutable message) {
	stats.readMeta++;
	return true;
}
 
开发者ID:Devexperts,项目名称:QD,代码行数:6,代码来源:DataService.java

示例13: sendMeta

import org.cometd.bayeux.server.ServerMessage; //导入方法依赖的package包/类
@Override
public boolean sendMeta(ServerSession session, ServerMessage.Mutable message) {
	stats.writeMeta++;
	return true;
}
 
开发者ID:Devexperts,项目名称:QD,代码行数:6,代码来源:DataService.java

示例14: addHeadersToMessage

import org.cometd.bayeux.server.ServerMessage; //导入方法依赖的package包/类
public void addHeadersToMessage(ServerMessage.Mutable cometdMessage, Message camelMessage) {
    if (camelMessage.hasHeaders()) {
        Map<String, Object> ext = cometdMessage.getExt(true);
        ext.put(HEADERS_FIELD, filterHeaders(camelMessage.getHeaders()));
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:7,代码来源:CometdBinding.java

示例15: rcv

import org.cometd.bayeux.server.ServerMessage; //导入方法依赖的package包/类
public boolean rcv(ServerSession from, ServerMessage.Mutable message) {
    return true;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:CometdProducerConsumerInteractiveAuthenticatedMain.java


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