Examples of AsciiBuffer


Examples of org.fusesource.hawtbuf.AsciiBuffer

        String DATA = "abcdefghijklmnopqrstuvwxyz";
        String body = "";
        for( int i=0; i < size; i ++) {
            body += DATA.charAt(i%DATA.length());
        }
       Buffer msg = new AsciiBuffer(body);

        MQTT mqtt = new MQTT();
        mqtt.setHost(host, port);
        mqtt.setUserName(user);
        mqtt.setPassword(password);

        FutureConnection connection = mqtt.futureConnection();
        connection.connect().await();

        final LinkedList<Future<Void>> queue = new LinkedList<Future<Void>>();
        UTF8Buffer topic = new UTF8Buffer(destination);
        for( int i=1; i <= messages; i ++) {

            // Send the publish without waiting for it to complete. This allows us
            // to send multiple message without blocking..
            queue.add(connection.publish(topic, msg, QoS.AT_LEAST_ONCE, false));

            // Eventually we start waiting for old publish futures to complete
            // so that we don't create a large in memory buffer of outgoing message.s
            if( queue.size() >= 1000 ) {
                queue.removeFirst().await();
            }

        }

        queue.add(connection.publish(topic, new AsciiBuffer("SHUTDOWN"), QoS.AT_LEAST_ONCE, false));
        while( !queue.isEmpty() ) {
            queue.removeFirst().await();
        }

        connection.disconnect().await();
View Full Code Here

Examples of org.fusesource.hawtbuf.AsciiBuffer

        String DATA = "abcdefghijklmnopqrstuvwxyz";
        String body = "";
        for( int i=0; i < size; i ++) {
            body += DATA.charAt(i%DATA.length());
        }
       Buffer msg = new AsciiBuffer(body);

        MQTT mqtt = new MQTT();
        mqtt.setHost(host, port);
        mqtt.setUserName(user);
        mqtt.setPassword(password);

        FutureConnection connection = mqtt.futureConnection();
        connection.connect().await();

        final LinkedList<Future<Void>> queue = new LinkedList<Future<Void>>();
        UTF8Buffer topic = new UTF8Buffer(destination);
        for( int i=1; i <= messages; i ++) {

            // Send the publish without waiting for it to complete. This allows us
            // to send multiple message without blocking..
            queue.add(connection.publish(topic, msg, QoS.AT_LEAST_ONCE, false));

            // Eventually we start waiting for old publish futures to complete
            // so that we don't create a large in memory buffer of outgoing message.s
            if( queue.size() >= 1000 ) {
                queue.removeFirst().await();
            }

        }

        queue.add(connection.publish(topic, new AsciiBuffer("SHUTDOWN"), QoS.AT_LEAST_ONCE, false));
        while( !queue.isEmpty() ) {
            queue.removeFirst().await();
        }

        connection.disconnect().await();
View Full Code Here

Examples of org.fusesource.hawtbuf.AsciiBuffer

                func.run();
            } else {
                if (host.store() != null) {
                    // We load all the persisted session's from the host's store when we are first accessed.
                    queue.suspend();
                    host.store().get_prefixed_map_entries(new AsciiBuffer("mqtt:"), Scala2Java.toScala(new UnitFn1<Seq<Tuple2<Buffer, Buffer>>>() {
                        @Override
                        public void call(final Seq<Tuple2<Buffer, Buffer>> entries) {
                            queue.resume();
                            queue.execute(new Task() {
                                @Override
View Full Code Here

Examples of org.fusesource.hawtbuf.AsciiBuffer

    public void setPhysicalName(String value) {
        physicalName = value;
        String[] composites = value.split(",");
        if(composites.length == 1) {
            Path path = PARSER.parsePath(new AsciiBuffer(composites[0]));
            switch(getDestinationType()) {
                case QUEUE_TYPE:
                    destination = create_destination(LocalRouter.QUEUE_DOMAIN(), path);
                    break;
                case TOPIC_TYPE:
View Full Code Here

Examples of org.fusesource.hawtbuf.AsciiBuffer

    public int getPriority() {
        return message.getPriority();
    }

    public AsciiBuffer getMsgId() {
        return new AsciiBuffer(message.getMessageId().toString());
    }
View Full Code Here

Examples of org.fusesource.hawtbuf.AsciiBuffer

        return new AsciiBuffer(message.getMessageId().toString());
    }

    public AsciiBuffer getProducerId() {
        if (producerId == null) {
            producerId = new AsciiBuffer(message.getProducerId().toString());
        }
        return producerId;
    }
View Full Code Here

Examples of org.fusesource.hawtbuf.AsciiBuffer

        int previous = 0;
        int lastIndex = subject.getLength() - 1;
        while (true) {
            int idx = subject.indexOf(path_seperator, previous);
            if (idx < 0) {
              AsciiBuffer buffer = subject.slice(previous, lastIndex + 1).ascii();
                list.add(parsePart(buffer));
                break;
            }
          AsciiBuffer buffer = subject.slice(previous, idx).ascii();
            list.add(parsePart(buffer));
            previous = idx + 1;
        }
        return new Path(new ArrayList(list));
    }
View Full Code Here

Examples of org.fusesource.hawtbuf.AsciiBuffer

        boolean first=true;
        for(Part p : path.parts) {
            if( !first ) {
                path_seperator.writeTo(os);
            }
            new AsciiBuffer(p.toString(this)).writeTo(os);
            first = false;
        }
    }
View Full Code Here

Examples of org.fusesource.hawtbuf.AsciiBuffer

public class PathMapMemoryTest {

    PathParser parser = new PathParser();

    protected Path createDestination(String name) {
       return parser.parsePath(new AsciiBuffer(name));
    }
View Full Code Here

Examples of org.fusesource.hawtbuf.AsciiBuffer

        Collections.sort(actual);
        assertEquals(("map value for destinationName:  " + destination), expectedList, actual);
    }

    protected Path createDestination(String name) {
       return parser.parsePath(new AsciiBuffer(name));
    }
View Full Code Here
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.