Package org.activemq.transport.stomp

Source Code of org.activemq.transport.stomp.Unsubscribe

/*
* Copyright (c) 2005 Your Corporation. All Rights Reserved.
*/
package org.activemq.transport.stomp;

import org.activemq.message.ActiveMQDestination;

import java.io.DataInput;
import java.io.IOException;
import java.util.Properties;

public class Unsubscribe implements Command
{
    private static final HeaderParser parser = new HeaderParser();
    private final StompWireFormat format;

    Unsubscribe(StompWireFormat format)
    {
        this.format = format;
    }

    public PacketEnvelope build(String commandLine, DataInput in) throws IOException
    {
        Properties headers = parser.parse(in);
        while (in.readByte() == 0) {}

        String dest_name = headers.getProperty(Stomp.Headers.Unsubscribe.DESTINATION);
        ActiveMQDestination destination = DestinationNamer.convert(dest_name);

        Subscription s =  format.getSubscriptionFor(destination);
        return new PacketEnvelope(s.close(), headers);
    }
}
TOP

Related Classes of org.activemq.transport.stomp.Unsubscribe

TOP
Copyright © 2018 www.massapi.com. 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.