Examples of Message


Examples of com.alibaba.otter.canal.protocol.Message

                MDC.put("destination", destination);
                connector.connect();
                connector.subscribe("");
                connector.rollback();
                while (running) {
                    Message message = connector.getWithoutAck(batchSize); // 获取指定数量的数据
                    long batchId = message.getId();
                    int size = message.getEntries().size();
                    if (batchId == -1 || size == 0) {
                        // try {
                        // Thread.sleep(1000);
                        // } catch (InterruptedException e) {
                        // }
                    } else {
                        printSummary(message, batchId, size);
                        printEntry(message.getEntries());
                    }

                    connector.ack(batchId); // 提交确认
                    // connector.rollback(batchId); // 处理失败, 回滚数据
                }
View Full Code Here

Examples of com.alibaba.otter.node.etl.select.selector.Message

                arbitrateEventService.toolEvent().waitForPermit(pipelineId);// 出现rollback后能及时停住

                // 使用startVersion要解决的一个问题:出现rollback时,尽可能判断取出来的数据是rollback前还是rollback后,想办法丢弃rollback前的数据。
                // (因为出现rollback,之前取出去的几个批次的数据其实是没有执行成功,get取出来的数据会是其后一批数据,如果不丢弃的话,会出现后面的数据先执行,然后又回到出错的点,再执行一遍)
                // int startVersion = rversion.get();
                Message gotMessage = otterSelector.selector();

                // modify by ljh at 2012-09-10,startVersion获取操作应该放在拿到数据之后
                // 放在前面 : (遇到一个并发bug)
                // // a.
                // 先拿startVersion,再获取数据,在拿数据过程中rollback开始并完成了,导致selector返回时数据已经取到了末尾
                // // b. 在进行version判断时发现已经有变化,导致又触发一次拿数据的过程,此时的get
                // cursor已经到队列的末尾,拿不出任何数据,所以出现死等情况
                // 放在后面 : (一点点瑕疵)
                // // a.
                // 并发操作rollback和selector时,针对拿到rollback前的老数据,此时startVersion还未初始化,导致判断不出出现过rollback操作,后面的变更数据会提前同步
                // (概率性会比较高,取决于selector和初始化startVersion的时间间隔)
                int startVersion = rversion.get();

                if (canStartSelector.state() == false) { // 是否出现异常
                    // 回滚在出现异常的瞬间,拿出来的数据,因为otterSelector.selector()会循环,可能出现了rollback,其还未感知到
                    rollback(gotMessage.getId());
                    continue;
                }

                if (CollectionUtils.isEmpty(gotMessage.getDatas())) {// 处理下空数据,也得更新下游标,可能是回环数据被过滤掉
                    // 添加到待响应的buffer列表,不需要await termin信号,因为没启动过s/e/t/l流程
                    batchBuffer.put(new BatchTermin(gotMessage.getId(), false));
                    continue;
                }

                final EtlEventData etlEventData = arbitrateEventService.selectEvent().await(pipelineId);
                if (rversion.get() != startVersion) {// 说明存在过变化,中间出现过rollback,需要丢弃该数据
                    logger.warn("rollback happend , should skip this data and get new message.");
                    canStartSelector.get();// 确认一下rollback是否完成
                    gotMessage = otterSelector.selector();// 这时不管有没有数据,都需要执行一次s/e/t/l
                }

                final Message message = gotMessage;
                final BatchTermin batchTermin = new BatchTermin(message.getId(), etlEventData.getProcessId());
                batchBuffer.put(batchTermin); // 添加到待响应的buffer列表
                Runnable task = new Runnable() {

                    public void run() {
                        // 设置profiling信息
                        boolean profiling = isProfiling();
                        Long profilingStartTime = null;
                        if (profiling) {
                            profilingStartTime = System.currentTimeMillis();
                        }

                        MDC.put(OtterConstants.splitPipelineLogFileKey, String.valueOf(pipelineId));
                        String currentName = Thread.currentThread().getName();
                        Thread.currentThread().setName(createTaskName(pipelineId, "SelectWorker"));
                        try {
                            pipeline = configClientService.findPipeline(pipelineId);
                            List<EventData> eventData = message.getDatas();
                            long startTime = etlEventData.getStartTime();
                            if (!CollectionUtils.isEmpty(eventData)) {
                                startTime = eventData.get(0).getExecuteTime();
                            }

                            Channel channel = configClientService.findChannelByPipelineId(pipelineId);
                            RowBatch rowBatch = new RowBatch();
                            // 构造唯一标识
                            Identity identity = new Identity();
                            identity.setChannelId(channel.getId());
                            identity.setPipelineId(pipelineId);
                            identity.setProcessId(etlEventData.getProcessId());
                            rowBatch.setIdentity(identity);
                            // 进行数据合并
                            for (EventData data : eventData) {
                                rowBatch.merge(data);
                            }

                            long nextNodeId = etlEventData.getNextNid();
                            List<PipeKey> pipeKeys = rowDataPipeDelegate.put(new DbBatch(rowBatch), nextNodeId);
                            etlEventData.setDesc(pipeKeys);
                            etlEventData.setNumber((long) eventData.size());
                            etlEventData.setFirstTime(startTime); // 使用原始数据的第一条
                            etlEventData.setBatchId(message.getId());

                            if (profiling) {
                                Long profilingEndTime = System.currentTimeMillis();
                                stageAggregationCollector.push(pipelineId,
                                                               StageType.SELECT,
View Full Code Here

Examples of com.alibaba.rocketmq.common.message.Message

                this.defaultMQPullConsumer.getConsumerGroup(), delayLevel, 3000);
        }
        catch (Exception e) {
            log.error("sendMessageBack Exception, " + this.defaultMQPullConsumer.getConsumerGroup(), e);

            Message newMsg =
                    new Message(MixAll.getRetryTopic(this.defaultMQPullConsumer.getConsumerGroup()),
                        msg.getBody());

            newMsg.setFlag(msg.getFlag());
            newMsg.setProperties(msg.getProperties());
            newMsg.putProperty(MessageConst.PROPERTY_RETRY_TOPIC, msg.getTopic());

            this.mQClientFactory.getDefaultMQProducer().send(newMsg);
        }
    }
View Full Code Here

Examples of com.aliyun.openservices.ons.api.Message

        // ProducerId,代表一类Producer,请向MetaQ运维人员申请
        properties.put(PropertyKeyConst.ProducerId, "ProducerId1");
        properties.put(PropertyKeyConst.ProducerId, "ProducerId1");
        Producer producer = ONSFactory.createProducer(properties);
        producer.start();
        Message msg = new Message(//
            "TopicTestONS", // Topic, 请向ONS运维人员申请
            "TagA", // Tag, 相当于子Topic概念,应用可以自由设置,Consumer消费时,可以通过他来过滤消息
            "Hello ONS".getBytes()// 消息内容,二进制形式
                );
        SendResult sendResult = producer.send(msg);
View Full Code Here

Examples of com.almende.eve.entity.Message

      .type(Message.class)
      .addFilter("agent", FilterOperator.EQUAL, getFirstUrl())
      .now();
   
    while (it.hasNext()) {
      Message message = it.next();
      datastore.delete(message);
      // TODO: bulk delete all messages instead of one by one
    }
  }
View Full Code Here

Examples of com.amazonaws.services.kinesis.multilang.messages.Message

    private boolean waitForStatusMessage(String action, IRecordProcessorCheckpointer checkpointer) {
        StatusMessage statusMessage = null;
        while (statusMessage == null) {
            Future<Message> future = this.messageReader.getNextMessageFromSTDOUT();
            try {
                Message message = future.get();
                // Note that instanceof doubles as a check against a value being null
                if (message instanceof CheckpointMessage) {
                    boolean checkpointWriteSucceeded =
                            Boolean.valueOf(checkpoint((CheckpointMessage) message, checkpointer).get());
                    if (!checkpointWriteSucceeded) {
View Full Code Here

Examples of com.amazonaws.services.simpleemail.model.Message

        Destination dest = new Destination().withToAddresses(toAddresses);
        request.setDestination(dest);

        Content subjContent = new Content().withData(subject);
        Message msg = new Message().withSubject(subjContent);

        // Include a body in both text and HTML formats
        Body theBody = new Body();
        if (textBody != null) {
            theBody.withText(new Content().withData(textBody));
        }
        if (htmlBody != null) {
            theBody.withHtml(new Content().withData(htmlBody));
        }
        msg.setBody(theBody);

        request.setMessage(msg);

        // Call Amazon SES to send the message
        String messageId = null;
View Full Code Here

Examples of com.amazonaws.services.sqs.model.Message

        return result;
    }

    @Override
    public SendMessageResult sendMessage(SendMessageRequest sendMessageRequest) throws AmazonServiceException, AmazonClientException {
        Message message = new Message();
        message.setBody(sendMessageRequest.getMessageBody());
        message.setMD5OfBody("6a1559560f67c5e7a7d5d838bf0272ee");
        message.setMessageId("f6fb6f99-5eb2-4be4-9b15-144774141458");
        message.setReceiptHandle("0NNAq8PwvXsyZkR6yu4nQ07FGxNmOBWi5zC9+4QMqJZ0DJ3gVOmjI2Gh/oFnb0IeJqy5Zc8kH4JX7GVpfjcEDjaAPSeOkXQZRcaBqt"
                + "4lOtyfj0kcclVV/zS7aenhfhX5Ixfgz/rHhsJwtCPPvTAdgQFGYrqaHly+etJiawiNPVc=");
        synchronized (messages) {
            messages.add(message);
        }
View Full Code Here

Examples of com.android.tools.idea.gradle.messages.Message

            type = Message.Type.WARNING;
        }

        LOG.info(msg);

        errorsFound.add(new Message(FAILED_TO_SET_UP_DEPENDENCIES, type, msg));

        // fall back to library dependency, if available.
        if (hasLibraryBackup) {
            updateDependency(model, backup);
        }
View Full Code Here

Examples of com.apigee.flow.message.Message

    private static final Logger logger = LoggerFactory.getLogger("SubmitTaskAndPauseForCompletion");

  @Override
  public ExecutionResult execute(MessageContext messageContext, ExecutionContext executionContext) {
    Message message = messageContext.getMessage();
    // Blocking code here
    // ...
    //
    executionContext.submitTask(new AuthenticationTask(), new PostAuthenticationCallback(), executionContext);
    // This line resumes after the submitTask is done.
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.