本文整理了Java中com.hazelcast.core.Message.getPublishingMember()
方法的一些代码示例,展示了Message.getPublishingMember()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getPublishingMember()
方法的具体详情如下:
包路径:com.hazelcast.core.Message
类名称:Message
方法名:getPublishingMember
[英]Returns the member that published the message. It can be that the member is null if:
代码示例来源:origin: spring-projects/spring-integration-extensions
@Override
protected void processEvent(Message<E> event) {
sendMessage(event, event.getPublishingMember().getSocketAddress(), getCacheListeningPolicy());
if (logger.isDebugEnabled()) {
logger.debug("Received Message : " + event);
}
}
代码示例来源:origin: org.geoserver.community/gs-hz-cluster
@Override
public void onMessage(Message<UUID> message) {
UUID eventId = message.getMessageObject();
AtomicInteger countDown = expectedAckCounters.get(eventId);
if (countDown != null) {
countDown.decrementAndGet();
String originAddr = null;
Member publishingMember = message.getPublishingMember();
if (publishingMember != null) {
InetSocketAddress socketAddress = publishingMember.getSocketAddress();
if (socketAddress != null) {
originAddr = addressString(socketAddress);
}
}
LOGGER.finer(
format("%s - Got ack on event %s from %s", nodeId(), eventId, originAddr));
}
}
}
代码示例来源:origin: com.atlassian.cache/atlassian-cache-hazelcast
@Override
public void onMessage(Message<ReferenceKey> message) {
CachedReference<?> localReference = localReferenceRef.get();
if (localReference == null)
{
// cache has been gc-d
destroy();
return;
}
if (!message.getPublishingMember().localMember())
{
localReference.reset();
}
}
代码示例来源:origin: com.jtbdevelopment.core-games/games-hazelcast
@Override
public void onMessage(final Message<ClusterMessage> message) {
if (message != null && !message.getPublishingMember().localMember()) {
ClusterMessage clusterMessage = message.getMessageObject();
if (clusterMessage != null) {
receiveClusterMessage(clusterMessage);
}
}
}
}
代码示例来源:origin: spring-projects/spring-integration-extensions
@Override
protected org.springframework.messaging.Message<?> toMessage(Message<E> event) {
Assert.notNull(event.getMessageObject(), "message must not be null");
final Map<String, Object> headers = new HashMap<>();
headers.put(HazelcastHeaders.MEMBER, event.getPublishingMember().getSocketAddress());
headers.put(HazelcastHeaders.CACHE_NAME, event.getSource());
headers.put(HazelcastHeaders.PUBLISHING_TIME, event.getPublishTime());
return getMessageBuilderFactory().withPayload(event.getMessageObject()).copyHeaders(headers).build();
}
代码示例来源:origin: com.hazelcast/hazelcast-hibernate4
public void onMessage(final Message<Object> message) {
if (!message.getPublishingMember().localMember()) {
maybeInvalidate(message.getMessageObject());
}
}
};
代码示例来源:origin: io.snamp/internal-services
private static HazelcastNodeInfo getHazelcastNodeInfo(final Message<TransferObject> hzMessage){
return new HazelcastNodeInfo(hzMessage.getPublishingMember(), hzMessage.getMessageObject().isSenderActive, hzMessage.getMessageObject().senderName);
}
代码示例来源:origin: com.atlassian.cache/atlassian-cache-hazelcast
@Override
public void onMessage(Message<K> message) {
Cache<K, ?> localCache = localCacheRef.get();
if (localCache == null)
{
// cache has been gc-d
destroy();
return;
}
if (!message.getPublishingMember().localMember())
{
K key = message.getMessageObject();
if (key == null)
{
localCache.removeAll();
}
else
{
localCache.remove(key);
}
}
}
代码示例来源:origin: io.moquette/moquette-broker
@Override
public void onMessage(Message<HazelcastMsg> msg) {
ByteBuf payload = null;
try {
if (!msg.getPublishingMember().equals(server.getHazelcastInstance().getCluster().getLocalMember())) {
HazelcastMsg hzMsg = msg.getMessageObject();
LOG.info("{} received from hazelcast for topic {} message: {}", hzMsg.getClientId(), hzMsg.getTopic(),
hzMsg.getPayload());
// TODO pass forward this information in somehow publishMessage.setLocal(false);
MqttQoS qos = MqttQoS.valueOf(hzMsg.getQos());
MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.PUBLISH, false, qos, false, 0);
MqttPublishVariableHeader varHeader = new MqttPublishVariableHeader(hzMsg.getTopic(), 0);
payload = Unpooled.wrappedBuffer(hzMsg.getPayload());
MqttPublishMessage publishMessage = new MqttPublishMessage(fixedHeader, varHeader, payload);
server.internalPublish(publishMessage, hzMsg.getClientId());
}
} catch (Exception ex) {
LOG.error("error polling hazelcast msg queue", ex);
} finally {
ReferenceCountUtil.release(payload);
}
}
}
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
public void onMessage(Message message) {
if (!endpoint.isAlive()) {
return;
}
if (!(message instanceof DataAwareMessage)) {
throw new IllegalArgumentException("Expecting: DataAwareMessage, Found: "
+ message.getClass().getSimpleName());
}
DataAwareMessage dataAwareMessage = (DataAwareMessage) message;
Data messageData = dataAwareMessage.getMessageData();
String publisherUuid = message.getPublishingMember().getUuid();
ClientMessage eventMessage = TopicAddMessageListenerCodec.encodeTopicEvent(messageData,
message.getPublishTime(), publisherUuid);
boolean isMultithreaded = nodeEngine.getConfig().findTopicConfig(parameters.name).isMultiThreadingEnabled();
if (isMultithreaded) {
int key = rand.nextInt();
int partitionId = hashToIndex(key, nodeEngine.getPartitionService().getPartitionCount());
eventMessage.setPartitionId(partitionId);
sendClientMessage(eventMessage);
} else {
sendClientMessage(partitionKey, eventMessage);
}
}
}
代码示例来源:origin: com.hazelcast/hazelcast-all
@Override
public void onMessage(Message message) {
if (!endpoint.isAlive()) {
return;
}
if (!(message instanceof DataAwareMessage)) {
throw new IllegalArgumentException("Expecting: DataAwareMessage, Found: "
+ message.getClass().getSimpleName());
}
DataAwareMessage dataAwareMessage = (DataAwareMessage) message;
Data messageData = dataAwareMessage.getMessageData();
String publisherUuid = message.getPublishingMember().getUuid();
ClientMessage eventMessage = TopicAddMessageListenerCodec.encodeTopicEvent(messageData,
message.getPublishTime(), publisherUuid);
boolean isMultithreaded = nodeEngine.getConfig().findTopicConfig(parameters.name).isMultiThreadingEnabled();
if (isMultithreaded) {
int key = rand.nextInt();
int partitionId = hashToIndex(key, nodeEngine.getPartitionService().getPartitionCount());
eventMessage.setPartitionId(partitionId);
sendClientMessage(eventMessage);
} else {
sendClientMessage(partitionKey, eventMessage);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!