Tabnine Logo
ConsumerControl
Code IndexAdd Tabnine to your IDE (free)

How to use
ConsumerControl
in
org.apache.activemq.command

Best Java code snippets using org.apache.activemq.command.ConsumerControl (Showing top 20 results out of 315)

Refine searchRefine arrow

  • DataOutput
  • DataInput
  • ConsumerInfo
origin: apache/activemq

/**
 * inform the MessageConsumer on the client to change it's prefetch
 *
 * @param newPrefetch
 */
@Override
public void updateConsumerPrefetch(int newPrefetch) {
  if (context != null && context.getConnection() != null && context.getConnection().isManageable()) {
    ConsumerControl cc = new ConsumerControl();
    cc.setConsumerId(info.getConsumerId());
    cc.setPrefetch(newPrefetch);
    context.getConnection().dispatchAsync(cc);
  }
}
origin: apache/activemq

/**
 * Un-marshal an object instance from the data input stream
 *
 * @param o the object to un-marshal
 * @param dataIn the data input stream to build the object from
 * @throws IOException
 */
public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
  super.looseUnmarshal(wireFormat, o, dataIn);
  ConsumerControl info = (ConsumerControl)o;
  info.setDestination((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
  info.setClose(dataIn.readBoolean());
  info.setConsumerId((org.apache.activemq.command.ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn));
  info.setPrefetch(dataIn.readInt());
  info.setFlush(dataIn.readBoolean());
  info.setStart(dataIn.readBoolean());
  info.setStop(dataIn.readBoolean());
}
origin: apache/activemq

  /**
   * Write the booleans that this object uses to a BooleanStream
   */
  public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {

    ConsumerControl info = (ConsumerControl)o;

    super.looseMarshal(wireFormat, o, dataOut);
    dataOut.writeBoolean(info.isClose());
    looseMarshalNestedObject(wireFormat, (DataStructure)info.getConsumerId(), dataOut);
    dataOut.writeInt(info.getPrefetch());
    dataOut.writeBoolean(info.isFlush());
    dataOut.writeBoolean(info.isStart());
    dataOut.writeBoolean(info.isStop());

  }
}
origin: apache/activemq

  /**
   * Write the booleans that this object uses to a BooleanStream
   */
  public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {

    ConsumerControl info = (ConsumerControl)o;

    super.looseMarshal(wireFormat, o, dataOut);
    dataOut.writeBoolean(info.isClose());
    looseMarshalNestedObject(wireFormat, (DataStructure)info.getConsumerId(), dataOut);
    dataOut.writeInt(info.getPrefetch());

  }
}
origin: apache/activemq

/**
 * Un-marshal an object instance from the data input stream
 *
 * @param o the object to un-marshal
 * @param dataIn the data input stream to build the object from
 * @throws IOException
 */
public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
  super.looseUnmarshal(wireFormat, o, dataIn);
  ConsumerControl info = (ConsumerControl)o;
  info.setClose(dataIn.readBoolean());
  info.setConsumerId((org.apache.activemq.command.ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn));
  info.setPrefetch(dataIn.readInt());
  info.setFlush(dataIn.readBoolean());
  info.setStart(dataIn.readBoolean());
  info.setStop(dataIn.readBoolean());
}
origin: apache/activemq

/**
 * Un-marshal an object instance from the data input stream
 *
 * @param o the object to un-marshal
 * @param dataIn the data input stream to build the object from
 * @throws IOException
 */
public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
  super.looseUnmarshal(wireFormat, o, dataIn);
  ConsumerControl info = (ConsumerControl)o;
  info.setClose(dataIn.readBoolean());
  info.setConsumerId((org.apache.activemq.command.ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn));
  info.setPrefetch(dataIn.readInt());
}
origin: apache/activemq

/**
 * 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);
  ConsumerControl info = (ConsumerControl)o;
  bs.readBoolean();
  tightMarshalNestedObject2(wireFormat, (DataStructure)info.getConsumerId(), dataOut, bs);
  dataOut.writeInt(info.getPrefetch());
}
origin: apache/activemq

/**
 * 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);
  ConsumerControl info = (ConsumerControl)o;
  tightMarshalNestedObject2(wireFormat, (DataStructure)info.getDestination(), dataOut, bs);
  bs.readBoolean();
  tightMarshalNestedObject2(wireFormat, (DataStructure)info.getConsumerId(), dataOut, bs);
  dataOut.writeInt(info.getPrefetch());
  bs.readBoolean();
  bs.readBoolean();
  bs.readBoolean();
}
origin: apache/activemq

public void connectionInterruptProcessingComplete(Transport transport, ConnectionId connectionId) {
  ConnectionState connectionState = connectionStates.get(connectionId);
  if (connectionState != null) {
    connectionState.setConnectionInterruptProcessingComplete(true);
    Map<ConsumerId, ConsumerInfo> stalledConsumers = connectionState.getRecoveringPullConsumers();
    for (Entry<ConsumerId, ConsumerInfo> entry: stalledConsumers.entrySet()) {
      ConsumerControl control = new ConsumerControl();
      control.setConsumerId(entry.getKey());
      control.setPrefetch(entry.getValue().getPrefetchSize());
      control.setDestination(entry.getValue().getDestination());
      try {
        if (LOG.isDebugEnabled()) {
          LOG.debug("restored recovering consumer: " + control.getConsumerId() + " with: " + control.getPrefetch());
        }
        transport.oneway(control);
      } catch (Exception ex) {
        if (LOG.isDebugEnabled()) {
          LOG.debug("Failed to submit control for consumer: " + control.getConsumerId()
              + " with: " + control.getPrefetch(), ex);
        }
      }
    }
    stalledConsumers.clear();
  }
}
origin: apache/activemq

/**
 * Write the booleans that this object uses to a BooleanStream
 */
public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
  ConsumerControl info = (ConsumerControl)o;
  int rc = super.tightMarshal1(wireFormat, o, bs);
  bs.writeBoolean(info.isClose());
  rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getConsumerId(), bs);
  bs.writeBoolean(info.isFlush());
  bs.writeBoolean(info.isStart());
  bs.writeBoolean(info.isStop());
  return rc + 4;
}
origin: apache/activemq

protected void onConsumerControl(ConsumerControl command) {
  if (command.isClose()) {
    for (ActiveMQSession session : this.sessions) {
      session.close(command.getConsumerId());
    }
  } else {
    for (ActiveMQSession session : this.sessions) {
      session.setPrefetchSize(command.getConsumerId(), command.getPrefetch());
    }
    for (ActiveMQConnectionConsumer connectionConsumer: connectionConsumers) {
      ConsumerInfo consumerInfo = connectionConsumer.getConsumerInfo();
      if (consumerInfo.getConsumerId().equals(command.getConsumerId())) {
        consumerInfo.setPrefetchSize(command.getPrefetch());
      }
    }
  }
}
origin: apache/activemq

@Override
public void processConsumerControl(ConsumerBrokerExchange consumerExchange, ConsumerControl control) {
  Subscription sub = subscriptions.get(control.getConsumerId());
  if (sub != null && sub instanceof AbstractSubscription) {
    ((AbstractSubscription) sub).setPrefetchSize(control.getPrefetch());
    if (broker.getDestinationPolicy() != null) {
      PolicyEntry entry = broker.getDestinationPolicy().getEntryFor(control.getDestination());
      if (entry != null) {
        entry.configurePrefetch(sub);
      }
    }
    LOG.debug("setting prefetch: {}, on subscription: {}; resulting value: {}", new Object[]{ control.getPrefetch(), control.getConsumerId(), sub.getConsumerInfo().getPrefetchSize()});
    try {
      lookup(consumerExchange.getConnectionContext(), control.getDestination(),false).wakeup();
    } catch (Exception e) {
      LOG.warn("failed to deliver post consumerControl dispatch-wakeup, to destination: {}", control.getDestination(), e);
    }
  }
}
origin: apache/activemq

  LOG.trace("Connection {} being aborted because of slow consumer: {} on destination: {}",
       new Object[] { connection.getConnectionId(),
               subscription.getConsumerInfo().getConsumerId(),
               subscription.getActiveMQDestination() });
final Subscription subToClose = subscription;
LOG.info("aborting slow consumer: {} for destination:{}",
     subscription.getConsumerInfo().getConsumerId(),
     subscription.getActiveMQDestination());
  ConsumerControl stopConsumer = new ConsumerControl();
  stopConsumer.setConsumerId(subscription.getConsumerInfo().getConsumerId());
  stopConsumer.setClose(true);
  connection.dispatchAsync(stopConsumer);
} catch (Exception e) {
origin: apache/activemq

/**
 * @return a new object instance
 */
public DataStructure createObject() {
  return new ConsumerControl();
}
origin: apache/activemq

@Override
public void processConsumerControl(ConsumerBrokerExchange consumerExchange, ConsumerControl control) {
  control.setDestination(convertDestination(control.getDestination()));
  super.processConsumerControl(consumerExchange, control);
}
origin: apache/activemq

/**
 * Write the booleans that this object uses to a BooleanStream
 */
public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
  ConsumerControl info = (ConsumerControl)o;
  int rc = super.tightMarshal1(wireFormat, o, bs);
  bs.writeBoolean(info.isClose());
  rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getConsumerId(), bs);
  return rc + 4;
}
origin: apache/activemq

@Override
public void processConsumerControl(ConsumerBrokerExchange consumerExchange, ConsumerControl control) {
  ActiveMQDestination destination = control.getDestination();
  try {
    getRegion(destination).processConsumerControl(consumerExchange, control);
  } catch (JMSException jmse) {
    LOG.warn("unmatched destination: {}, in consumerControl: {}", destination, control);
  }
}
origin: apache/activemq

@Override
public Response processConsumerControl(ConsumerControl control) throws Exception {
  ConsumerBrokerExchange consumerExchange = getConsumerBrokerExchange(control.getConsumerId());
  broker.processConsumerControl(consumerExchange, control);
  return null;
}
origin: apache/activemq

/**
 * Un-marshal an object instance from the data input stream
 *
 * @param o the object to un-marshal
 * @param dataIn the data input stream to build the object from
 * @throws IOException
 */
public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
  super.tightUnmarshal(wireFormat, o, dataIn, bs);
  ConsumerControl info = (ConsumerControl)o;
  info.setClose(bs.readBoolean());
  info.setConsumerId((org.apache.activemq.command.ConsumerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
  info.setPrefetch(dataIn.readInt());
}
origin: org.apache.activemq/activemq-client

  /**
   * Write the booleans that this object uses to a BooleanStream
   */
  public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {

    ConsumerControl info = (ConsumerControl)o;

    super.looseMarshal(wireFormat, o, dataOut);
    dataOut.writeBoolean(info.isClose());
    looseMarshalNestedObject(wireFormat, (DataStructure)info.getConsumerId(), dataOut);
    dataOut.writeInt(info.getPrefetch());

  }
}
org.apache.activemq.commandConsumerControl

Javadoc

Used to start and stop transports as well as terminating clients.

Most used methods

  • <init>
  • setConsumerId
  • setPrefetch
  • setDestination
  • getConsumerId
  • getPrefetch
  • getDestination
  • setClose
  • isClose
  • isFlush
  • isStart
  • isStop
  • isStart,
  • isStop,
  • setFlush,
  • setStart,
  • setStop

Popular in Java

  • Reading from database using SQL prepared statement
  • requestLocationUpdates (LocationManager)
  • addToBackStack (FragmentTransaction)
  • onCreateOptionsMenu (Activity)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now