public long removeSubscription(final long registrationId) { final long correlationId = toDriverCommandBuffer.nextCorrelationId(); removeMessage .registrationId(registrationId) .correlationId(correlationId); if (!toDriverCommandBuffer.write(REMOVE_SUBSCRIPTION, buffer, 0, RemoveMessageFlyweight.length())) { throw new AeronException("could not write remove subscription message"); } return correlationId; }
@Test public void threadSendsRemoveChannelMessage() { conductor.removePublication(CORRELATION_ID); assertReadsOneMessage( (msgTypeId, buffer, index, length) -> { final RemoveMessageFlyweight message = new RemoveMessageFlyweight(); message.wrap(buffer, index); assertThat(msgTypeId, is(REMOVE_PUBLICATION)); assertThat(message.registrationId(), is(CORRELATION_ID)); } ); }
private static void dissect(final RemoveMessageFlyweight msg, final StringBuilder builder) { builder .append(msg.registrationId()) .append(" [") .append(msg.clientId()) .append(':') .append(msg.correlationId()) .append(']'); }
removeMsgFlyweight.wrap(buffer, index); correlationId = removeMsgFlyweight.correlationId(); conductor.onRemovePublication(removeMsgFlyweight.registrationId(), correlationId); break; removeMsgFlyweight.wrap(buffer, index); correlationId = removeMsgFlyweight.correlationId(); conductor.onRemoveSubscription(removeMsgFlyweight.registrationId(), correlationId); break; removeMsgFlyweight.wrap(buffer, index); correlationId = removeMsgFlyweight.correlationId(); conductor.onRemoveCounter(removeMsgFlyweight.registrationId(), correlationId); break;
public DriverProxy(final RingBuffer toDriverCommandBuffer, final long clientId) { this.toDriverCommandBuffer = toDriverCommandBuffer; publicationMessage.wrap(buffer, 0); subscriptionMessage.wrap(buffer, 0); correlatedMessage.wrap(buffer, 0); removeMessage.wrap(buffer, 0); destinationMessage.wrap(buffer, 0); counterMessage.wrap(buffer, 0); correlatedMessage.clientId(clientId); }
private final PublicationMessageFlyweight publicationMessage = new PublicationMessageFlyweight(); private final SubscriptionMessageFlyweight subscriptionMessage = new SubscriptionMessageFlyweight(); private final RemoveMessageFlyweight removeMessage = new RemoveMessageFlyweight(); private final CorrelatedMessageFlyweight correlatedMessage = new CorrelatedMessageFlyweight(); private final DestinationMessageFlyweight destinationMessage = new DestinationMessageFlyweight();
removeMsgFlyweight.wrap(buffer, index); correlationId = removeMsgFlyweight.correlationId(); conductor.onRemovePublication(removeMsgFlyweight.registrationId(), correlationId); break; removeMsgFlyweight.wrap(buffer, index); correlationId = removeMsgFlyweight.correlationId(); conductor.onRemoveSubscription(removeMsgFlyweight.registrationId(), correlationId); break; removeMsgFlyweight.wrap(buffer, index); correlationId = removeMsgFlyweight.correlationId(); conductor.onRemoveCounter(removeMsgFlyweight.registrationId(), correlationId); break;
case CMD_IN_REMOVE_COUNTER: final RemoveMessageFlyweight removeCmd = REMOVE_MSG; removeCmd.wrap(buffer, offset + relativeOffset); dissect(removeCmd, builder); break;
private final PublicationMessageFlyweight publicationMessage = new PublicationMessageFlyweight(); private final SubscriptionMessageFlyweight subscriptionMessage = new SubscriptionMessageFlyweight(); private final RemoveMessageFlyweight removeMessage = new RemoveMessageFlyweight(); private final CorrelatedMessageFlyweight correlatedMessage = new CorrelatedMessageFlyweight(); private final DestinationMessageFlyweight destinationMessage = new DestinationMessageFlyweight();
public long removeCounter(final long registrationId) { final long correlationId = toDriverCommandBuffer.nextCorrelationId(); removeMessage .registrationId(registrationId) .correlationId(correlationId); if (!toDriverCommandBuffer.write(REMOVE_COUNTER, buffer, 0, RemoveMessageFlyweight.length())) { throw new AeronException("could not write remove counter command"); } return correlationId; }
removeMsgFlyweight.wrap(buffer, index); correlationId = removeMsgFlyweight.correlationId(); conductor.onRemovePublication(removeMsgFlyweight.registrationId(), correlationId); break; removeMsgFlyweight.wrap(buffer, index); correlationId = removeMsgFlyweight.correlationId(); conductor.onRemoveSubscription(removeMsgFlyweight.registrationId(), correlationId); break; removeMsgFlyweight.wrap(buffer, index); correlationId = removeMsgFlyweight.correlationId(); conductor.onRemoveCounter(removeMsgFlyweight.registrationId(), correlationId); break;
@Test public void threadSendsRemoveSubscriberMessage() { conductor.removeSubscription(CORRELATION_ID); assertReadsOneMessage( (msgTypeId, buffer, index, length) -> { final RemoveMessageFlyweight removeMessage = new RemoveMessageFlyweight(); removeMessage.wrap(buffer, index); assertThat(msgTypeId, is(REMOVE_SUBSCRIPTION)); assertThat(removeMessage.registrationId(), is(CORRELATION_ID)); } ); }
private static void dissect(final RemoveMessageFlyweight msg, final StringBuilder builder) { builder .append(msg.registrationId()) .append(" [") .append(msg.clientId()) .append(':') .append(msg.correlationId()) .append(']'); }
public DriverProxy(final RingBuffer toDriverCommandBuffer, final long clientId) { this.toDriverCommandBuffer = toDriverCommandBuffer; publicationMessage.wrap(buffer, 0); subscriptionMessage.wrap(buffer, 0); correlatedMessage.wrap(buffer, 0); removeMessage.wrap(buffer, 0); destinationMessage.wrap(buffer, 0); counterMessage.wrap(buffer, 0); correlatedMessage.clientId(clientId); }
private final PublicationMessageFlyweight publicationMessage = new PublicationMessageFlyweight(); private final SubscriptionMessageFlyweight subscriptionMessage = new SubscriptionMessageFlyweight(); private final RemoveMessageFlyweight removeMessage = new RemoveMessageFlyweight(); private final CorrelatedMessageFlyweight correlatedMessage = new CorrelatedMessageFlyweight(); private final DestinationMessageFlyweight destinationMessage = new DestinationMessageFlyweight();
public long removePublication(final long registrationId) { final long correlationId = toDriverCommandBuffer.nextCorrelationId(); removeMessage .registrationId(registrationId) .correlationId(correlationId); if (!toDriverCommandBuffer.write(REMOVE_PUBLICATION, buffer, 0, RemoveMessageFlyweight.length())) { throw new AeronException("could not write remove publication command"); } return correlationId; }
public DriverProxy(final RingBuffer toDriverCommandBuffer, final long clientId) { this.toDriverCommandBuffer = toDriverCommandBuffer; publicationMessage.wrap(buffer, 0); subscriptionMessage.wrap(buffer, 0); correlatedMessage.wrap(buffer, 0); removeMessage.wrap(buffer, 0); destinationMessage.wrap(buffer, 0); counterMessage.wrap(buffer, 0); correlatedMessage.clientId(clientId); }
public long removeCounter(final long registrationId) { final long correlationId = toDriverCommandBuffer.nextCorrelationId(); removeMessage .registrationId(registrationId) .correlationId(correlationId); if (!toDriverCommandBuffer.write(REMOVE_COUNTER, buffer, 0, RemoveMessageFlyweight.length())) { throw new AeronException("could not write remove counter command"); } return correlationId; }
case CMD_IN_REMOVE_COUNTER: final RemoveMessageFlyweight removeCmd = REMOVE_MSG; removeCmd.wrap(buffer, offset + relativeOffset); dissect(removeCmd, builder); break;
public long removeSubscription(final long registrationId) { final long correlationId = toDriverCommandBuffer.nextCorrelationId(); removeMessage .registrationId(registrationId) .correlationId(correlationId); if (!toDriverCommandBuffer.write(REMOVE_SUBSCRIPTION, buffer, 0, RemoveMessageFlyweight.length())) { throw new AeronException("could not write remove subscription message"); } return correlationId; }