Examples of UTF8Buffer


Examples of org.fusesource.hawtbuf.UTF8Buffer

    protected void looseMarshalThrowable(OpenWireFormat wireFormat, Throwable o, DataByteArrayOutputStream dataOut)
        throws IOException {
        dataOut.writeBoolean(o != null);
        if (o != null) {
            String className = o instanceof OpenwireException ? ((OpenwireException)o).getClassName() : o.getClass().getName();
            looseMarshalString(new UTF8Buffer(className), dataOut);
            looseMarshalString(new UTF8Buffer(o.getMessage()), dataOut);
            if (wireFormat.isStackTraceEnabled()) {
                StackTraceElement[] stackTrace = o.getStackTrace();
                dataOut.writeShort(stackTrace.length);
                for (int i = 0; i < stackTrace.length; i++) {
                    StackTraceElement element = stackTrace[i];
                    looseMarshalString(new UTF8Buffer(element.getClassName()), dataOut);
                    looseMarshalString(new UTF8Buffer(element.getMethodName()), dataOut);
                    looseMarshalString(new UTF8Buffer(element.getFileName()), dataOut);
                    dataOut.writeInt(element.getLineNumber());
                }
                looseMarshalThrowable(wireFormat, o.getCause(), dataOut);
            }
        }
View Full Code Here

Examples of org.fusesource.hawtbuf.UTF8Buffer

        if (p >= 0) {
            sessionId = Long.parseLong(sessionKey.substring(p + 1));
            sessionKey = sessionKey.substring(0, p);
        }
        // The rest is the value
        connectionId = new UTF8Buffer(sessionKey);
    }
View Full Code Here

Examples of org.fusesource.hawtbuf.UTF8Buffer

        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));
View Full Code Here

Examples of org.fusesource.hawtbuf.UTF8Buffer

        return url;
    }

    public void setURL(URL url) {
        this.url = url;
        remoteBlobUrl = url != null ? new UTF8Buffer(url.toExternalForm()) : null;
    }
View Full Code Here

Examples of org.fusesource.hawtbuf.UTF8Buffer

            public final UTF8Buffer session_key;

            public StoreStrategy(Store store, UTF8Buffer client_id) {
                this.store = store;
                this.client_id = client_id;
                this.session_key = new UTF8Buffer("mqtt:" + client_id);
            }
View Full Code Here

Examples of org.fusesource.hawtbuf.UTF8Buffer

                    Topic topic = entry._1();
                    BindAddress address = entry._2();
                    TopicPB.Bean topic_pb = new TopicPB.Bean();
                    topic_pb.setName(topic.name());
                    topic_pb.setQos(topic.qos().ordinal());
                    topic_pb.setAddress(new UTF8Buffer(address.toString()));
                    session_pb.addSubscriptions(topic_pb);
                }
                uow.put(session_key, session_pb.freeze().toUnframedBuffer());

                final DispatchQueue current = Dispatch.getCurrentQueue();
View Full Code Here

Examples of org.fusesource.hawtbuf.UTF8Buffer

        if( (connect_message.clientId() == null || connect_message.clientId().length==0) && !connect_message.cleanSession() ) {
            die(connack, "A clean session must be requested when no client id is provided.");
        }

        UTF8Buffer client_id = connect_message.clientId();
        security_context.user_$eq(Scala2Java.toString(connect_message.userName()));
        security_context.password_$eq(Scala2Java.toString(connect_message.password()));
        security_context.session_id_$eq(client_id.toString());

        final short keep_alive = connect_message.keepAlive();
        if (keep_alive > 0) {
            heart_beat_monitor.setReadInterval(((long) (keep_alive * 1.5)) * 1000);
            heart_beat_monitor.setOnDead(new Task() {
View Full Code Here

Examples of org.fusesource.hawtbuf.UTF8Buffer

  public ActiveMQDestination() {
  }

  protected ActiveMQDestination(String name) {
      setPhysicalName(new UTF8Buffer(name));
  }
View Full Code Here

Examples of org.fusesource.hawtbuf.UTF8Buffer

        } else {
            qoS = message.isPersistent() ? QoS.AT_MOST_ONCE : QoS.AT_LEAST_ONCE;
        }
        result.qos(qoS);

        UTF8Buffer topicName;
        synchronized (mqttTopicMap) {
            topicName = mqttTopicMap.get(message.getJMSDestination());
            if (topicName == null) {
                topicName = new UTF8Buffer(message.getDestination().getPhysicalName().replace('.', '/'));
                mqttTopicMap.put(message.getJMSDestination(), topicName);
            }
        }
        result.topicName(topicName);
View Full Code Here

Examples of org.fusesource.hawtbuf.UTF8Buffer

                HashMap<String, Object> jsonMap = new HashMap<String, Object>();
                jsonMap.put("@class", "queue_destination");
                jsonMap.put("name", dest.getQueueName());
                String json = mapper.writeValueAsString(jsonMap);
                System.out.println(json);
                destRecord.setBindingData(new UTF8Buffer(json));
                manager.store_queue(destRecord);

                queue.recover(new MessageRecoveryListener() {
                    public boolean hasSpace() {
                        return true;
                    }

                    public boolean recoverMessageReference(MessageId ref) throws Exception {
                        return true;
                    }

                    public boolean isDuplicate(MessageId ref) {
                        return false;
                    }

                    public boolean recoverMessage(Message message) throws IOException {
                        messageKeyCounter[0]++;
                        seqKeyCounter[0]++;

                        MessagePB.Bean messageRecord = createMessagePB(message, messageKeyCounter[0]);
                        manager.store_message(messageRecord);

                        QueueEntryPB.Bean entryRecord = createQueueEntryPB(message, containerKeyCounter[0], seqKeyCounter[0], messageKeyCounter[0]);
                        manager.store_queue_entry(entryRecord);

                        return true;
                    }
                });

            } else if (odest instanceof ActiveMQTopic) {
                ActiveMQTopic dest = (ActiveMQTopic) odest;

                TopicMessageStore topic = store.createTopicMessageStore(dest);
                for (SubscriptionInfo sub : topic.getAllSubscriptions()) {

                    QueuePB.Bean destRecord = new QueuePB.Bean();
                    destRecord.setKey(containerKeyCounter[0]);
                    destRecord.setBindingKind(ds_kind);

                    // TODO: use a real JSON encoder like jackson.
                    HashMap<String, Object> jsonMap = new HashMap<String, Object>();
                    jsonMap.put("@class", "dsub_destination");
                    jsonMap.put("name", sub.getClientId() + ":" + sub.getSubcriptionName());
                    HashMap<String, Object> jsonTopic = new HashMap<String, Object>();
                    jsonTopic.put("name", dest.getTopicName());
                    jsonMap.put("topics", new Object[]{jsonTopic});
                    if (sub.getSelector() != null) {
                        jsonMap.put("selector", sub.getSelector());
                    }
                    String json = mapper.writeValueAsString(jsonMap);
                    System.out.println(json);

                    destRecord.setBindingData(new UTF8Buffer(json));
                    manager.store_queue(destRecord);

                    final long seqKeyCounter[] = new long[]{0};
                    topic.recoverSubscription(sub.getClientId(), sub.getSubcriptionName(), new MessageRecoveryListener() {
                        public boolean hasSpace() {
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.