Package org.codehaus.activemq.message

Examples of org.codehaus.activemq.message.ActiveMQObjectMessage


     * @return an ActiveMQObjectMessage
     * @throws JMSException if the JMS provider fails to create this message due to some internal error.
     */
    public ObjectMessage createObjectMessage() throws JMSException {
        checkClosed();
        return new ActiveMQObjectMessage();
    }
View Full Code Here


     * @return an ActiveMQObjectMessage
     * @throws JMSException if the JMS provider fails to create this message due to some internal error.
     */
    public ObjectMessage createObjectMessage(Serializable object) throws JMSException {
        checkClosed();
        ActiveMQObjectMessage msg = new ActiveMQObjectMessage();
        msg.setObject(object);
        return msg;
    }
View Full Code Here

        Packet actual = writeThenReadPacket(expected);
        assertTextMessage(expected, (ActiveMQTextMessage) actual);
    }

    public void testObjectMessage() throws Exception {
        ActiveMQObjectMessage expected = createObjectMessage();
        Packet actual = writeThenReadPacket(expected);
        assertObjectMessage(expected, (ActiveMQObjectMessage) actual);
    }
View Full Code Here

        assertMessage(expected, actual);
        assertEquals("object", expected.getObject(), actual.getObject());
    }

    protected ActiveMQObjectMessage createObjectMessage() throws JMSException {
        ActiveMQObjectMessage answer = new ActiveMQObjectMessage();
        answer.setObject("This is some text");
        configureMessage(answer);
        return answer;
    }
View Full Code Here

        if (this.keepAliveMessage != null) {
            this.keepAliveMessage.setBooleanProperty(STARTED_TYPE, true);
            sendKeepAlive();
        }
        this.serviceName = name;
        this.serviceMessage = new ActiveMQObjectMessage();
        this.serviceMessage.setJMSType(SERVICE_TYPE);
        this.serviceMessage.setStringProperty(SERVICE_NAME, name);
        this.serviceMessage.setStringProperty(CHANNEL_NAME, channelName);
        this.serviceMessage.setObject((Serializable) details);
        sendService();
View Full Code Here

        }
    }

    private void processService(ActiveMQMessage message) throws JMSException {
        if (message != null) {
            ActiveMQObjectMessage objMsg = (ActiveMQObjectMessage) message;
            String name = objMsg.getStringProperty(SERVICE_NAME);
            addService(name);
            ActiveMQObjectMessage oldMsg = (ActiveMQObjectMessage) services.get(name);
            services.put(name, objMsg);
            if (oldMsg == null) {
                fireServiceStarted(objMsg);
                //send out that we are here!
                sendService();
View Full Code Here

        activeTime.set(timestamp);
    }

    private void removeService(String name) throws JMSException {
        keepAliveMap.remove(name);
        ActiveMQObjectMessage message = (ActiveMQObjectMessage) services.remove(name);
        if (message != null) {
            fireServiceStopped(message);
        }
    }
View Full Code Here

        return result;
    }

    private void generateAdvisoryMessage(final ConsumerInfo advisoryTarget, final BrokerClient targetClient,
            final Packet payload, final ActiveMQDestination destination) {
        ActiveMQObjectMessage advisoryMsg = new ActiveMQObjectMessage();
        advisoryMsg.setJMSMessageID(idGen.generateId());
        advisoryMsg.setJMSDestination(destination);
        advisoryMsg.setExternalMessageId(true);
        advisoryMsg.setDeliveryCount(DeliveryMode.NON_PERSISTENT);
        try {
            advisoryMsg.setObject((Serializable) payload);
        }
        catch (JMSException e) {
            log.warn("caught an exception generating an advisory", e);
        }
        advisoryMsg.setConsumerNos(new int[]{advisoryTarget.getConsumerNo()});
        targetClient.dispatch(advisoryMsg);
    }
View Full Code Here

  public ActiveMQObjectMessageReaderTest(String arg0) {
    super(arg0);
  }

  public void testGetPacketType() {
    ActiveMQObjectMessage msg = new ActiveMQObjectMessage();
    assertTrue(msg.getPacketType() == Packet.ACTIVEMQ_OBJECT_MESSAGE);
  }
View Full Code Here

  }

  public void testReadPacket() {
    ActiveMQObjectMessageReader reader = new ActiveMQObjectMessageReader();
    ActiveMQObjectMessageWriter writer = new ActiveMQObjectMessageWriter();
    ActiveMQObjectMessage msg1 = new ActiveMQObjectMessage();
    try {
      msg1.setObject(this.table);
      super.initializeMessage(msg1);
      byte[] data = writer.writePacketToByteArray(msg1);
      ActiveMQObjectMessage msg2 = (ActiveMQObjectMessage) reader.readPacketFromByteArray(data);
      super.testEquals(msg1, msg2);
      assertTrue(msg1.getObject().equals(msg2.getObject()));
    }
    catch (IOException e) {
      e.printStackTrace();
      assertTrue(false);
    }
View Full Code Here

TOP

Related Classes of org.codehaus.activemq.message.ActiveMQObjectMessage

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.