Package org.apache.activemq.command

Examples of org.apache.activemq.command.ActiveMQMapMessage


     * @return an ActiveMQMapMessage
     * @throws JMSException if the JMS provider fails to create this message due
     *                 to some internal error.
     */
    public MapMessage createMapMessage() throws JMSException {
        ActiveMQMapMessage message = new ActiveMQMapMessage();
        configureMessage(message);
        return message;
    }
View Full Code Here


            msg.setReadOnlyBody(true);
            byte[] data = new byte[(int) msg.getBodyLength()];
            msg.readBytes(data);
            result.payload(new Buffer(data));
        } else if (message.getDataStructureType() == ActiveMQMapMessage.DATA_STRUCTURE_TYPE) {
            ActiveMQMapMessage msg = (ActiveMQMapMessage) message.copy();
            msg.setReadOnlyBody(true);
            Map<String, Object> map = msg.getContentMap();
            if (map != null) {
                result.payload(new Buffer(map.toString().getBytes("UTF-8")));
            }
        } else {
            ByteSequence byteSequence = message.getContent();
View Full Code Here

     */
    @Test
    public void testConvertsValidMapWithSimpleValuesToMapMessage() throws JMSException
    {
        Session session = mock(Session.class);
        when(session.createMapMessage()).thenReturn(new ActiveMQMapMessage());

        // Creates a test Map with data
        Map data = new HashMap();
        data.put("value1", new Float(4));
        data.put("value2", new byte[] {1, 2, 3});
View Full Code Here

        return "";
      case ActiveMQBlobMessage.DATA_STRUCTURE_TYPE:
        ActiveMQBlobMessage blob = (ActiveMQBlobMessage) message;
        return blob.getRemoteBlobUrl();
      case ActiveMQMapMessage.DATA_STRUCTURE_TYPE:
        ActiveMQMapMessage map = (ActiveMQMapMessage)message;
        return map.getContentMap().toString();     
      case ActiveMQTextMessage.DATA_STRUCTURE_TYPE:
        ActiveMQTextMessage text = (ActiveMQTextMessage)message;
        return text.getText();
      case ActiveMQBytesMessage.DATA_STRUCTURE_TYPE:
      case ActiveMQObjectMessage.DATA_STRUCTURE_TYPE:
View Full Code Here

                ActiveMQDestination queryDest = ActiveMQDestination.createDestination(queueryName,msgDest.getDestinationType());
                Set<Destination> set = getDestinations(queryDest);
                for (Destination dest : set) {
                    DestinationStatistics stats = dest.getDestinationStatistics();
                    if (stats != null) {
                        ActiveMQMapMessage statsMessage = new ActiveMQMapMessage();
                        statsMessage.setString("destinationName", dest.getActiveMQDestination().toString());
                        statsMessage.setLong("size", stats.getMessages().getCount());
                        statsMessage.setLong("enqueueCount", stats.getEnqueues().getCount());
                        statsMessage.setLong("dequeueCount", stats.getDequeues().getCount());
                        statsMessage.setLong("dispatchCount", stats.getDispatched().getCount());
                        statsMessage.setLong("expiredCount", stats.getExpired().getCount());
                        statsMessage.setLong("inflightCount", stats.getInflight().getCount());
                        statsMessage.setLong("messagesCached", stats.getMessagesCached().getCount());
                        statsMessage.setInt("memoryPercentUsage", dest.getMemoryUsage().getPercentUsage());
                        statsMessage.setLong("memoryUsage", dest.getMemoryUsage().getUsage());
                        statsMessage.setLong("memoryLimit", dest.getMemoryUsage().getLimit());
                        statsMessage.setDouble("averageEnqueueTime", stats.getProcessTime().getAverageTime());
                        statsMessage.setDouble("maxEnqueueTime", stats.getProcessTime().getMaxTime());
                        statsMessage.setDouble("minEnqueueTime", stats.getProcessTime().getMinTime());
                        statsMessage.setLong("consumerCount", stats.getConsumers().getCount());
                        statsMessage.setLong("producerCount", stats.getProducers().getCount());
                        sendStats(producerExchange.getConnectionContext(), statsMessage, replyTo);
                    }
                }
            } else if (brokerStats) {
                ActiveMQMapMessage statsMessage = new ActiveMQMapMessage();
                BrokerService brokerService = getBrokerService();
                RegionBroker regionBroker = (RegionBroker) brokerService.getRegionBroker();
                SystemUsage systemUsage = brokerService.getSystemUsage();
                DestinationStatistics stats = regionBroker.getDestinationStatistics();
                statsMessage.setString("brokerName", regionBroker.getBrokerName());
                statsMessage.setString("brokerId", regionBroker.getBrokerId().toString());
                statsMessage.setLong("size", stats.getMessages().getCount());
                statsMessage.setLong("enqueueCount", stats.getEnqueues().getCount());
                statsMessage.setLong("dequeueCount", stats.getDequeues().getCount());
                statsMessage.setLong("dispatchCount", stats.getDispatched().getCount());
                statsMessage.setLong("expiredCount", stats.getExpired().getCount());
                statsMessage.setLong("inflightCount", stats.getInflight().getCount());
                statsMessage.setLong("messagesCached", stats.getMessagesCached().getCount());
                statsMessage.setInt("memoryPercentUsage", systemUsage.getMemoryUsage().getPercentUsage());
                statsMessage.setLong("memoryUsage", systemUsage.getMemoryUsage().getUsage());
                statsMessage.setLong("memoryLimit", systemUsage.getMemoryUsage().getLimit());
                statsMessage.setInt("storePercentUsage", systemUsage.getStoreUsage().getPercentUsage());
                statsMessage.setLong("storeUsage", systemUsage.getStoreUsage().getUsage());
                statsMessage.setLong("storeLimit", systemUsage.getStoreUsage().getLimit());
                statsMessage.setInt("tempPercentUsage", systemUsage.getTempUsage().getPercentUsage());
                statsMessage.setLong("tempUsage", systemUsage.getTempUsage().getUsage());
                statsMessage.setLong("tempLimit", systemUsage.getTempUsage().getLimit());
                statsMessage.setDouble("averageEnqueueTime", stats.getProcessTime().getAverageTime());
                statsMessage.setDouble("maxEnqueueTime", stats.getProcessTime().getMaxTime());
                statsMessage.setDouble("minEnqueueTime", stats.getProcessTime().getMinTime());
                statsMessage.setLong("consumerCount", stats.getConsumers().getCount());
                statsMessage.setLong("producerCount", stats.getProducers().getCount());
                String answer = brokerService.getTransportConnectorURIsAsMap().get("tcp");
                answer = answer != null ? answer : "";
                statsMessage.setString("openwire", answer);
                answer = brokerService.getTransportConnectorURIsAsMap().get("stomp");
                answer = answer != null ? answer : "";
                statsMessage.setString("stomp", answer);
                answer = brokerService.getTransportConnectorURIsAsMap().get("ssl");
                answer = answer != null ? answer : "";
                statsMessage.setString("ssl", answer);
                answer = brokerService.getTransportConnectorURIsAsMap().get("stomp+ssl");
                answer = answer != null ? answer : "";
                statsMessage.setString("stomp+ssl", answer);
                URI uri = brokerService.getVmConnectorURI();
                answer = uri != null ? uri.toString() : "";
                statsMessage.setString("vm", answer);
                File file = brokerService.getDataDirectoryFile();
                answer = file != null ? file.getCanonicalPath() : "";
                statsMessage.setString("dataDirectory", answer);
                sendStats(producerExchange.getConnectionContext(), statsMessage, replyTo);
            } else {
                super.send(producerExchange, messageSend);
            }
        } else {
View Full Code Here

        return "";
      case ActiveMQBlobMessage.DATA_STRUCTURE_TYPE:
        ActiveMQBlobMessage blob = (ActiveMQBlobMessage) message;
        return blob.getRemoteBlobUrl();
      case ActiveMQMapMessage.DATA_STRUCTURE_TYPE:
        ActiveMQMapMessage map = (ActiveMQMapMessage)message;
        return map.getContentMap().toString();     
      case ActiveMQTextMessage.DATA_STRUCTURE_TYPE:
        ActiveMQTextMessage text = (ActiveMQTextMessage)message;
        return text.getText();
      case ActiveMQBytesMessage.DATA_STRUCTURE_TYPE:
      case ActiveMQObjectMessage.DATA_STRUCTURE_TYPE:
View Full Code Here

     * @return an ActiveMQMapMessage
     * @throws JMSException if the JMS provider fails to create this message due
     *                 to some internal error.
     */
    public MapMessage createMapMessage() throws JMSException {
        ActiveMQMapMessage message = new ActiveMQMapMessage();
        configureMessage(message);
        return message;
    }
View Full Code Here

      Map<String, String> headers = new HashMap<String, String>(25);
      command.setHeaders(headers);

      FrameTranslator.Helper.copyStandardHeadersFromMessageToFrame(
          converter, message, command, this);
      ActiveMQMapMessage msg = (ActiveMQMapMessage) message.copy();
      command.setContent(marshall((Serializable)msg.getContentMap(),
          headers.get(Stomp.Headers.TRANSFORMATION))
          .getBytes("UTF-8"));
      return command;   
    } else {
      return super.convertMessage(converter, message);
View Full Code Here

    objMsg.setObject((Serializable) obj);
    return objMsg;
  }
 
  protected ActiveMQMapMessage createMapMessage(HierarchicalStreamReader in) throws JMSException {
    ActiveMQMapMessage mapMsg = new ActiveMQMapMessage();
    Map<String, Object> map = (Map<String, Object>)getXStream().unmarshal(in);
    for (String key : map.keySet()) {
      mapMsg.setObject(key, map.get(key));
    }
    return mapMsg;
  }
View Full Code Here

     * @return an ActiveMQMapMessage
     * @throws JMSException if the JMS provider fails to create this message due
     *                 to some internal error.
     */
    public MapMessage createMapMessage() throws JMSException {
        ActiveMQMapMessage message = new ActiveMQMapMessage();
        configureMessage(message);
        return message;
    }
View Full Code Here

TOP

Related Classes of org.apache.activemq.command.ActiveMQMapMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.