org.apache.activemq.command.Message.setReadOnlyBody()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(253)

本文整理了Java中org.apache.activemq.command.Message.setReadOnlyBody()方法的一些代码示例,展示了Message.setReadOnlyBody()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.setReadOnlyBody()方法的具体详情如下:
包路径:org.apache.activemq.command.Message
类名称:Message
方法名:setReadOnlyBody

Message.setReadOnlyBody介绍

暂无

代码示例

代码示例来源:origin: apache/activemq

  1. /**
  2. * Browses the current destination with the given selector returning a list
  3. * of messages
  4. */
  5. @Override
  6. public List<Object> browseMessages(String selector) throws InvalidSelectorException {
  7. Message[] messages = destination.browse();
  8. ArrayList<Object> answer = new ArrayList<Object>();
  9. NonCachedMessageEvaluationContext ctx = new NonCachedMessageEvaluationContext();
  10. ctx.setDestination(destination.getActiveMQDestination());
  11. BooleanExpression selectorExpression = selector == null ? null : SelectorParser.parse(selector);
  12. for (int i = 0; i < messages.length; i++) {
  13. try {
  14. Message message = messages[i];
  15. message.setReadOnlyBody(true);
  16. if (selectorExpression == null) {
  17. answer.add(message);
  18. } else {
  19. ctx.setMessageReference(message);
  20. if (selectorExpression.matches(ctx)) {
  21. answer.add(message);
  22. }
  23. }
  24. } catch (Throwable e) {
  25. LOG.warn("exception browsing destination", e);
  26. }
  27. }
  28. return answer;
  29. }

代码示例来源:origin: apache/activemq

  1. @Override
  2. public Response processMessageDispatch(MessageDispatch md) throws Exception {
  3. waitForTransportInterruptionProcessingToComplete();
  4. ActiveMQDispatcher dispatcher = dispatchers.get(md.getConsumerId());
  5. if (dispatcher != null) {
  6. // Copy in case a embedded broker is dispatching via
  7. // vm://
  8. // md.getMessage() == null to signal end of queue
  9. // browse.
  10. Message msg = md.getMessage();
  11. if (msg != null) {
  12. msg = msg.copy();
  13. msg.setReadOnlyBody(true);
  14. msg.setReadOnlyProperties(true);
  15. msg.setRedeliveryCounter(md.getRedeliveryCounter());
  16. msg.setConnection(ActiveMQConnection.this);
  17. msg.setMemoryUsage(null);
  18. md.setMessage(msg);
  19. }
  20. dispatcher.dispatch(md);
  21. } else {
  22. LOG.debug("{} no dispatcher for {} in {}", this, md, dispatchers);
  23. }
  24. return null;
  25. }

代码示例来源:origin: org.apache.activemq/activemq-broker

  1. /**
  2. * Browses the current destination with the given selector returning a list
  3. * of messages
  4. */
  5. @Override
  6. public List<Object> browseMessages(String selector) throws InvalidSelectorException {
  7. Message[] messages = destination.browse();
  8. ArrayList<Object> answer = new ArrayList<Object>();
  9. NonCachedMessageEvaluationContext ctx = new NonCachedMessageEvaluationContext();
  10. ctx.setDestination(destination.getActiveMQDestination());
  11. BooleanExpression selectorExpression = selector == null ? null : SelectorParser.parse(selector);
  12. for (int i = 0; i < messages.length; i++) {
  13. try {
  14. Message message = messages[i];
  15. message.setReadOnlyBody(true);
  16. if (selectorExpression == null) {
  17. answer.add(message);
  18. } else {
  19. ctx.setMessageReference(message);
  20. if (selectorExpression.matches(ctx)) {
  21. answer.add(message);
  22. }
  23. }
  24. } catch (Throwable e) {
  25. LOG.warn("exception browsing destination", e);
  26. }
  27. }
  28. return answer;
  29. }

代码示例来源:origin: org.apache.activemq/activemq-all

  1. /**
  2. * Browses the current destination with the given selector returning a list
  3. * of messages
  4. */
  5. @Override
  6. public List<Object> browseMessages(String selector) throws InvalidSelectorException {
  7. Message[] messages = destination.browse();
  8. ArrayList<Object> answer = new ArrayList<Object>();
  9. NonCachedMessageEvaluationContext ctx = new NonCachedMessageEvaluationContext();
  10. ctx.setDestination(destination.getActiveMQDestination());
  11. BooleanExpression selectorExpression = selector == null ? null : SelectorParser.parse(selector);
  12. for (int i = 0; i < messages.length; i++) {
  13. try {
  14. Message message = messages[i];
  15. message.setReadOnlyBody(true);
  16. if (selectorExpression == null) {
  17. answer.add(message);
  18. } else {
  19. ctx.setMessageReference(message);
  20. if (selectorExpression.matches(ctx)) {
  21. answer.add(message);
  22. }
  23. }
  24. } catch (Throwable e) {
  25. LOG.warn("exception browsing destination", e);
  26. }
  27. }
  28. return answer;
  29. }

代码示例来源:origin: org.apache.activemq/activemq-osgi

  1. /**
  2. * Browses the current destination with the given selector returning a list
  3. * of messages
  4. */
  5. @Override
  6. public List<Object> browseMessages(String selector) throws InvalidSelectorException {
  7. Message[] messages = destination.browse();
  8. ArrayList<Object> answer = new ArrayList<Object>();
  9. NonCachedMessageEvaluationContext ctx = new NonCachedMessageEvaluationContext();
  10. ctx.setDestination(destination.getActiveMQDestination());
  11. BooleanExpression selectorExpression = selector == null ? null : SelectorParser.parse(selector);
  12. for (int i = 0; i < messages.length; i++) {
  13. try {
  14. Message message = messages[i];
  15. message.setReadOnlyBody(true);
  16. if (selectorExpression == null) {
  17. answer.add(message);
  18. } else {
  19. ctx.setMessageReference(message);
  20. if (selectorExpression.matches(ctx)) {
  21. answer.add(message);
  22. }
  23. }
  24. } catch (Throwable e) {
  25. LOG.warn("exception browsing destination", e);
  26. }
  27. }
  28. return answer;
  29. }

代码示例来源:origin: org.apache.activemq/activemq-client

  1. @Override
  2. public Response processMessageDispatch(MessageDispatch md) throws Exception {
  3. waitForTransportInterruptionProcessingToComplete();
  4. ActiveMQDispatcher dispatcher = dispatchers.get(md.getConsumerId());
  5. if (dispatcher != null) {
  6. // Copy in case a embedded broker is dispatching via
  7. // vm://
  8. // md.getMessage() == null to signal end of queue
  9. // browse.
  10. Message msg = md.getMessage();
  11. if (msg != null) {
  12. msg = msg.copy();
  13. msg.setReadOnlyBody(true);
  14. msg.setReadOnlyProperties(true);
  15. msg.setRedeliveryCounter(md.getRedeliveryCounter());
  16. msg.setConnection(ActiveMQConnection.this);
  17. msg.setMemoryUsage(null);
  18. md.setMessage(msg);
  19. }
  20. dispatcher.dispatch(md);
  21. } else {
  22. LOG.debug("{} no dispatcher for {} in {}", this, md, dispatchers);
  23. }
  24. return null;
  25. }

代码示例来源:origin: org.apache.activemq/activemq-all

  1. @Override
  2. public Response processMessageDispatch(MessageDispatch md) throws Exception {
  3. waitForTransportInterruptionProcessingToComplete();
  4. ActiveMQDispatcher dispatcher = dispatchers.get(md.getConsumerId());
  5. if (dispatcher != null) {
  6. // Copy in case a embedded broker is dispatching via
  7. // vm://
  8. // md.getMessage() == null to signal end of queue
  9. // browse.
  10. Message msg = md.getMessage();
  11. if (msg != null) {
  12. msg = msg.copy();
  13. msg.setReadOnlyBody(true);
  14. msg.setReadOnlyProperties(true);
  15. msg.setRedeliveryCounter(md.getRedeliveryCounter());
  16. msg.setConnection(ActiveMQConnection.this);
  17. msg.setMemoryUsage(null);
  18. md.setMessage(msg);
  19. }
  20. dispatcher.dispatch(md);
  21. } else {
  22. LOG.debug("{} no dispatcher for {} in {}", this, md, dispatchers);
  23. }
  24. return null;
  25. }

代码示例来源:origin: org.apache.activemq/activemq-osgi

  1. @Override
  2. public Response processMessageDispatch(MessageDispatch md) throws Exception {
  3. waitForTransportInterruptionProcessingToComplete();
  4. ActiveMQDispatcher dispatcher = dispatchers.get(md.getConsumerId());
  5. if (dispatcher != null) {
  6. // Copy in case a embedded broker is dispatching via
  7. // vm://
  8. // md.getMessage() == null to signal end of queue
  9. // browse.
  10. Message msg = md.getMessage();
  11. if (msg != null) {
  12. msg = msg.copy();
  13. msg.setReadOnlyBody(true);
  14. msg.setReadOnlyProperties(true);
  15. msg.setRedeliveryCounter(md.getRedeliveryCounter());
  16. msg.setConnection(ActiveMQConnection.this);
  17. msg.setMemoryUsage(null);
  18. md.setMessage(msg);
  19. }
  20. dispatcher.dispatch(md);
  21. } else {
  22. LOG.debug("{} no dispatcher for {} in {}", this, md, dispatchers);
  23. }
  24. return null;
  25. }

代码示例来源:origin: pierre/meteo

  1. @Override
  2. public Response processMessageDispatch(MessageDispatch md) throws Exception {
  3. waitForTransportInterruptionProcessingToComplete();
  4. ActiveMQDispatcher dispatcher = dispatchers.get(md.getConsumerId());
  5. if (dispatcher != null) {
  6. // Copy in case a embedded broker is dispatching via
  7. // vm://
  8. // md.getMessage() == null to signal end of queue
  9. // browse.
  10. Message msg = md.getMessage();
  11. if (msg != null) {
  12. msg = msg.copy();
  13. msg.setReadOnlyBody(true);
  14. msg.setReadOnlyProperties(true);
  15. msg.setRedeliveryCounter(md.getRedeliveryCounter());
  16. msg.setConnection(ActiveMQConnection.this);
  17. md.setMessage(msg);
  18. }
  19. dispatcher.dispatch(md);
  20. }
  21. return null;
  22. }

相关文章

Message类方法