Search in sources :

Example 31 with MessagingQos

use of io.joynr.messaging.MessagingQos in project joynr by bmwcarit.

the class PublicationManagerImpl method handleBroadcastSubscriptionRequest.

private void handleBroadcastSubscriptionRequest(String proxyParticipantId, String providerParticipantId, BroadcastSubscriptionRequest subscriptionRequest, ProviderContainer providerContainer) {
    logger.trace("adding broadcast publication: {}", subscriptionRequest);
    BroadcastListener broadcastListener = new BroadcastListenerImpl(subscriptionRequest.getSubscriptionId(), this);
    String broadcastName = subscriptionRequest.getSubscribedToName();
    providerContainer.getSubscriptionPublisher().registerBroadcastListener(broadcastName, broadcastListener);
    unregisterBroadcastListeners.put(subscriptionRequest.getSubscriptionId(), new UnregisterBroadcastListener(providerContainer.getSubscriptionPublisher(), broadcastName, broadcastListener));
    final String subscriptionId = subscriptionRequest.getSubscriptionId();
    SubscriptionQos subscriptionQos = subscriptionRequest.getQos();
    MessagingQos messagingQos = createMessagingQos(subscriptionQos);
    SubscriptionReply subscriptionReply = new SubscriptionReply(subscriptionId);
    dispatcher.sendSubscriptionReply(providerParticipantId, proxyParticipantId, subscriptionReply, messagingQos);
}
Also used : SubscriptionReply(joynr.SubscriptionReply) MessagingQos(io.joynr.messaging.MessagingQos) BroadcastListener(io.joynr.pubsub.publication.BroadcastListener) OnChangeSubscriptionQos(joynr.OnChangeSubscriptionQos) UnicastSubscriptionQos(joynr.UnicastSubscriptionQos) SubscriptionQos(io.joynr.pubsub.SubscriptionQos)

Example 32 with MessagingQos

use of io.joynr.messaging.MessagingQos in project joynr by bmwcarit.

the class PublicationManagerImpl method multicastOccurred.

@Override
public void multicastOccurred(String providerParticipantId, String multicastName, String[] partitions, Object... values) {
    logger.trace("Multicast occurred for {} / {} / {} / {}", providerParticipantId, multicastName, Arrays.toString(partitions), Arrays.toString(values));
    String multicastId = MulticastIdUtil.createMulticastId(providerParticipantId, multicastName, partitions);
    MulticastPublication multicastPublication = new MulticastPublication(Arrays.asList(values), multicastId);
    MessagingQos messagingQos = new MessagingQos();
    dispatcher.sendMulticast(providerParticipantId, multicastPublication, messagingQos);
}
Also used : MessagingQos(io.joynr.messaging.MessagingQos) MulticastPublication(joynr.MulticastPublication)

Example 33 with MessagingQos

use of io.joynr.messaging.MessagingQos in project joynr by bmwcarit.

the class DispatcherImpl method sendReply.

public void sendReply(final String fromParticipantId, final String toParticipantId, Reply reply, final long expiryDateMs, Map<String, String> customHeaders, final boolean compress) throws IOException {
    MessagingQos messagingQos = new MessagingQos(expiryDateMs);
    messagingQos.getCustomMessageHeaders().putAll(customHeaders);
    messagingQos.setCompress(compress);
    MutableMessage message = messageFactory.createReply(fromParticipantId, toParticipantId, reply, messagingQos);
    messageSender.sendMessage(message);
}
Also used : MessagingQos(io.joynr.messaging.MessagingQos) MutableMessage(joynr.MutableMessage)

Example 34 with MessagingQos

use of io.joynr.messaging.MessagingQos in project joynr by bmwcarit.

the class GlobalCapabilitiesDirectoryClient method getProxy.

private GlobalCapabilitiesDirectoryProxy getProxy(long ttl) {
    ProxyBuilder<GlobalCapabilitiesDirectoryProxy> capabilitiesProxyBuilder = proxyBuilderFactory.get(domain, GlobalCapabilitiesDirectoryProxy.class);
    MessagingQos messagingQos = new MessagingQos(ttl);
    return capabilitiesProxyBuilder.setDiscoveryQos(discoveryQos).setMessagingQos(messagingQos).build();
}
Also used : MessagingQos(io.joynr.messaging.MessagingQos) GlobalCapabilitiesDirectoryProxy(joynr.infrastructure.GlobalCapabilitiesDirectoryProxy)

Example 35 with MessagingQos

use of io.joynr.messaging.MessagingQos in project joynr by bmwcarit.

the class SubscriptionManagerImpl method unregisterSubscription.

@Override
public void unregisterSubscription(String fromParticipantId, Set<DiscoveryEntryWithMetaInfo> toDiscoveryEntries, String subscriptionId, MessagingQos qosSettings) {
    PubSubState subscriptionState = subscriptionStates.get(subscriptionId);
    if (subscriptionState != null) {
        logger.trace("Called unregister / unsubscribe on subscription id= " + subscriptionId);
        removeSubscription(subscriptionId);
    } else {
        logger.trace("Called unregister on a non/no longer existent subscription, used id= " + subscriptionId);
    }
    SubscriptionStop subscriptionStop = new SubscriptionStop(subscriptionId);
    dispatcher.sendSubscriptionStop(fromParticipantId, toDiscoveryEntries, subscriptionStop, new MessagingQos(qosSettings));
}
Also used : MessagingQos(io.joynr.messaging.MessagingQos) SubscriptionStop(joynr.SubscriptionStop)

Aggregations

MessagingQos (io.joynr.messaging.MessagingQos)55 Test (org.junit.Test)23 DiscoveryQos (io.joynr.arbitration.DiscoveryQos)19 MutableMessage (joynr.MutableMessage)15 JoynrRuntimeException (io.joynr.exceptions.JoynrRuntimeException)11 Matchers.anyString (org.mockito.Matchers.anyString)11 OnChangeSubscriptionQos (joynr.OnChangeSubscriptionQos)9 SubscriptionRequest (joynr.SubscriptionRequest)9 Before (org.junit.Before)8 Properties (java.util.Properties)6 ImmutableMessage (joynr.ImmutableMessage)6 Request (joynr.Request)6 Injector (com.google.inject.Injector)5 BroadcastSubscriptionRequest (joynr.BroadcastSubscriptionRequest)5 MulticastSubscriptionRequest (joynr.MulticastSubscriptionRequest)5 joynr.tests.testProxy (joynr.tests.testProxy)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 AbstractModule (com.google.inject.AbstractModule)4 IOException (java.io.IOException)4 OneWayRequest (joynr.OneWayRequest)4