@Override protected DemandSubscription createDemandSubscription(ConsumerInfo info) throws IOException { boolean isForcedDurable = NetworkBridgeUtils.isForcedDurable( info, dynamicallyIncludedDestinations, staticallyIncludedDestinations); if (addToAlreadyInterestedConsumers(info, isForcedDurable)) { return null; // don't want this subscription added } // add our original id to ourselves info.addNetworkConsumerId(info.getConsumerId()); ConsumerId forcedDurableId = isForcedDurable ? info.getConsumerId() : null; if (info.isDurable() || isForcedDurable) { // set the subscriber name to something reproducible info.setSubscriptionName(getSubscriberName(info.getDestination())); // and override the consumerId with something unique so that it won't // be removed if the durable subscriber (at the other end) goes away info.setConsumerId( new ConsumerId(localSessionInfo.getSessionId(), consumerIdGenerator.getNextSequenceId())); } info.setSelector(null); DemandSubscription demandSubscription = doCreateDemandSubscription(info); if (forcedDurableId != null) { demandSubscription.addForcedDurableConsumer(forcedDurableId); forcedDurableRemoteId.add(forcedDurableId); } return demandSubscription; }
/** Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConsumerInfo info = (ConsumerInfo) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure) info.getConsumerId(), dataOut); dataOut.writeBoolean(info.isBrowser()); looseMarshalCachedObject(wireFormat, (DataStructure) info.getDestination(), dataOut); dataOut.writeInt(info.getPrefetchSize()); dataOut.writeInt(info.getMaximumPendingMessageLimit()); dataOut.writeBoolean(info.isDispatchAsync()); looseMarshalString(info.getSelector(), dataOut); looseMarshalString(info.getSubscriptionName(), dataOut); dataOut.writeBoolean(info.isNoLocal()); dataOut.writeBoolean(info.isExclusive()); dataOut.writeBoolean(info.isRetroactive()); dataOut.writeByte(info.getPriority()); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); looseMarshalNestedObject(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut); dataOut.writeBoolean(info.isNetworkSubscription()); dataOut.writeBoolean(info.isOptimizedAcknowledge()); dataOut.writeBoolean(info.isNoRangeAcks()); looseMarshalObjectArray(wireFormat, info.getNetworkConsumerPath(), dataOut); }
/** * Write a object instance to data output stream * * @param o the instance to be marshaled * @param dataOut the output stream * @throws IOException thrown if an error occurs */ public void tightMarshal2( OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); ConsumerInfo info = (ConsumerInfo) o; tightMarshalCachedObject2(wireFormat, (DataStructure) info.getConsumerId(), dataOut, bs); bs.readBoolean(); tightMarshalCachedObject2(wireFormat, (DataStructure) info.getDestination(), dataOut, bs); dataOut.writeInt(info.getPrefetchSize()); dataOut.writeInt(info.getMaximumPendingMessageLimit()); bs.readBoolean(); tightMarshalString2(info.getSelector(), dataOut, bs); tightMarshalString2(info.getSubscriptionName(), dataOut, bs); bs.readBoolean(); bs.readBoolean(); bs.readBoolean(); dataOut.writeByte(info.getPriority()); tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs); tightMarshalNestedObject2( wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut, bs); bs.readBoolean(); bs.readBoolean(); bs.readBoolean(); tightMarshalObjectArray2(wireFormat, info.getNetworkConsumerPath(), dataOut, bs); }
@Override public void browseFinished() { MessageDispatch md = new MessageDispatch(); md.setConsumerId(info.getConsumerId()); md.setMessage(null); md.setDestination(null); session.deliverMessage(md); }
/** Write the booleans that this object uses to a BooleanStream */ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { ConsumerInfo info = (ConsumerInfo) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalCachedObject1(wireFormat, (DataStructure) info.getConsumerId(), bs); bs.writeBoolean(info.isBrowser()); rc += tightMarshalCachedObject1(wireFormat, (DataStructure) info.getDestination(), bs); bs.writeBoolean(info.isDispatchAsync()); rc += tightMarshalString1(info.getSelector(), bs); rc += tightMarshalString1(info.getSubscriptionName(), bs); bs.writeBoolean(info.isNoLocal()); bs.writeBoolean(info.isExclusive()); bs.writeBoolean(info.isRetroactive()); rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs); rc += tightMarshalNestedObject1(wireFormat, (DataStructure) info.getAdditionalPredicate(), bs); bs.writeBoolean(info.isNetworkSubscription()); bs.writeBoolean(info.isOptimizedAcknowledge()); bs.writeBoolean(info.isNoRangeAcks()); rc += tightMarshalObjectArray1(wireFormat, info.getNetworkConsumerPath(), bs); return rc + 9; }
public ConsumerId getId() { return info.getConsumerId(); }