Package com.taobao.metamorphosis.network

Examples of com.taobao.metamorphosis.network.PutCommand


        final long offset = 12;
        final Broker broker = new Broker(0, "meta://localhost:0");
        final int msgId = 1111;
        final byte[] data =
                MessageUtils.makeMessageBuffer(msgId,
                    new PutCommand(topic, partition.getPartition(), "hello".getBytes(), null, 0, 0)).array();
        final FetchRequest request =
                new FetchRequest(broker, 0, new TopicPartitionRegInfo(topic, partition, offset), maxSize);

        final FetchRequestRunner runner = this.fetchManager.new FetchRequestRunner();
View Full Code Here


        final long offset = 12;
        final Broker broker = new Broker(0, "meta://localhost:0");
        final int msgId = 1111;
        final byte[] data =
                MessageUtils.makeMessageBuffer(msgId,
                    new PutCommand(topic, partition.getPartition(), "hello".getBytes(), null, 0, 0)).array();
        final FetchRequest request =
                new FetchRequest(broker, 0, new TopicPartitionRegInfo(topic, partition, offset), maxSize);

        final FetchRequestRunner runner = this.fetchManager.new FetchRequestRunner();
View Full Code Here

        final long offset = 12;
        final Broker broker = new Broker(0, "meta://localhost:0");
        final int msgId = 1111;
        final byte[] data =
                makeInvalidMessageBuffer(msgId,
                    new PutCommand(topic, partition.getPartition(), "hello".getBytes(), null, 0, 0)).array();
        final FetchRequest request =
                new FetchRequest(broker, 0, new TopicPartitionRegInfo(topic, partition, offset), maxSize);

        final FetchRequestRunner runner = this.fetchManager.new FetchRequestRunner();
View Full Code Here

        final Partition partition = new Partition("0-0");
        final long offset = 12;
        final Broker broker = new Broker(0, "meta://localhost:0");
        final byte[] data =
                MessageUtils.makeMessageBuffer(1111,
                    new PutCommand(topic, partition.getPartition(), "hello".getBytes(), null, 0, 0)).array();
        final FetchRequest request =
                new FetchRequest(broker, 0, new TopicPartitionRegInfo(topic, partition, offset), maxSize);
        request.incrementRetriesAndGet();
        assertEquals(1, request.getRetries());
        EasyMock.expect(this.consumer.fetch(request, -1, null)).andReturn(new MessageIterator(topic, data));
View Full Code Here

        final Partition partition = new Partition("0-0");
        final long offset = 12;
        final Broker broker = new Broker(0, "meta://localhost:0");
        final byte[] data =
                MessageUtils.makeMessageBuffer(1111,
                    new PutCommand(topic, partition.getPartition(), "hello".getBytes(), null, 0, 0)).array();
        final FetchRequest request =
                new FetchRequest(broker, 0, new TopicPartitionRegInfo(topic, partition, offset), maxSize);

        final FetchRequestRunner runner = this.fetchManager.new FetchRequestRunner();
View Full Code Here

        final Partition partition = new Partition("0-0");
        final long offset = 12;
        final Broker broker = new Broker(0, "meta://localhost:0");
        final byte[] data =
                MessageUtils.makeMessageBuffer(1111,
                    new PutCommand(topic, partition.getPartition(), "hello".getBytes(), null, 0, 0)).array();
        final FetchRequest request =
                new FetchRequest(broker, 0, new TopicPartitionRegInfo(topic, partition, offset), maxSize);

        final FetchRequestRunner runner = this.fetchManager.new FetchRequestRunner();
View Full Code Here

            final int dataLength = Integer.parseInt(jettyRequest.getParameter("length"));
            final byte[] data = new byte[dataLength];

            inputStream.read(data);
            this.doResponseHeaders(response, "text/plain");
            final PutCommand putCommand = this.convert2PutCommand(topic, partition, data, flag, checkSum);
            this.commandProcessor.processPutCommand(putCommand, null, new PutCallback() {

                @Override
                public void putComplete(final ResponseCommand resp) {
                    final BooleanCommand responseCommand = (BooleanCommand) resp;
View Full Code Here

    }


    private PutCommand convert2PutCommand(final String topic, final int partition, final byte[] data, final int flag,
            int checkSum) {
        return new PutCommand(topic, partition, data, flag, checkSum, null, 0);
    }
View Full Code Here

            store = this.storeManager.getOrCreateMessageStore(message.getTopic(), partition);
            final long messageId = message.getId();
            this.brokerZooKeeper.registerTopicInZk(message.getTopic(), false);

            final AppendOp cb = new AppendOp();
            store.append(messageId, new PutCommand(message.getTopic(), partition, MessageUtils.encodePayload(message),
                null, MessageAccessor.getFlag(message), 0), cb);
            cb.latch.await(APPEND_TIMEOUT, TimeUnit.MILLISECONDS);
            if (cb.offset < 0) {
                log.error("offset wasless then 0 when append meta slave message");
                throw new AppendMessageErrorException("Append message failed,topic=" + message.getTopic());
View Full Code Here

            // ��5����������Ϊ��
            final int partition = i % 4;
            final int step = i;
            final MessageStore store = metaBroker.getStoreManager().getOrCreateMessageStore(topic, partition);
            final long msgId = idWorker.nextId();
            store.append(msgId, new PutCommand(topic, partition, data, null, 0, 0), new AppendCallback() {

                @Override
                public void appendComplete(final Location location) {
                    // �������1044����Ϊlocation��offset��������Ϣ�����
                    allMsgs.add(new MessageInfo(msgId, location.getOffset() + 1044, partition));
View Full Code Here

TOP

Related Classes of com.taobao.metamorphosis.network.PutCommand

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.