Examples of MessageData


Examples of com.appspot.piment.api.tqq.model.MessageData

    MessageResponse msgResponse = JSON.decode(singleStatusResponse, MessageResponse.class);
    if (msgResponse.isOK()) {
      result.add(msgResponse);
    } else {
      MessageData data = new MessageData();
      data.setId(timelineInfo.getId());
      data.setTimestamp(timelineInfo.getTimestamp());
      msgResponse.setData(data);
      result.add(msgResponse);
    }
    }
  }
View Full Code Here

Examples of com.appspot.piment.api.tqq.model.MessageData

    throw new RuntimeException(e);
  }
  }

  private void syncTqqUserMessage(UserMap userMap, MessageResponse msgResponse, WeiboMap weiboMap) {
  MessageData msgData = msgResponse.getData();
  try {

    log.info("Tqq Message --> [" + msgData.getId() + "]同期化中...");

    // 同期化履歴レコードの初期化
    weiboMap.setTqqWeiboId(Long.valueOf(msgData.getId()));
    weiboMap.setSinaWeiboId(null);
    weiboMap.setUserMapId(userMap.getId());
    weiboMap.setSource(WeiboSource.Tqq);
    weiboMap.setStatus(WeiboStatus.UNKNOW);

    if (!msgResponse.isOK()) {
    weiboMap.setStatus(WeiboStatus.FAILED);
    log.severe("Tqq Message --> [" + msgData.getId() + "]同期化失敗しました");
    return;
    }

    // 同期化対象判定
    if (userMap.isNeededMessageVirify()) {
    // 同期化不要のキーワードが合ったら処理をスキップする
    if (msgData.getOrigtext().contains(this.configMap.get("app.piment.unsync.keyword"))) {
      weiboMap.setStatus(WeiboStatus.SKIPPED);
      log.info("Tqq Message --> [" + msgData.getId() + "]同期化対象外とする");
      return;
    }
    }

    // 同じメッセージをsinaへ発表する
    Status status = null;
    Throwable throwable = null;
    String originalMsg = null;
    try {
    // // 转发微博的处理
    // if (status.isRetweet()) {
    //
    // String retweetId = null;
    // Status retweetedStatus = status.getRetweeted_status();
    // log.info("Sina Message --> Retweet [" + retweetedStatus.getId() +
    // "]");
    //
    // WeiboMap processedWeibo =
    // this.weiboMapDao.getBySinaWeiboId(retweetedStatus.getId());
    // if (processedWeibo != null) {
    // retweetId = String.valueOf(processedWeibo.getTqqWeiboId());
    // } else {
    //
    // originalMsg =
    // sinaWeiboApi.getOriginalMsg(retweetedStatus.getText().trim());
    //
    // StringBuilder retweetMsg = new StringBuilder();
    // retweetMsg.append("Sina@").append(retweetedStatus.getUser().getName()).append("//");
    // retweetMsg.append(originalMsg);
    // // TODO 長さ判定
    // retweetMsg.append("//Sina源:").append(SinaWeiboApi.getStatusPageURL(retweetedStatus.getUser().getId(),
    // retweetedStatus.getId()));
    //
    // Response middleResponse = null;//
    // tqqRobotWeiboApi.sendMessage(retweetMsg.toString(),
    // // retweetedStatus.getOriginal_pic(),
    // // null);
    // if (middleResponse != null && middleResponse.isOK()) {
    // log.info("Sina Message --> Retweet Successed!!!");
    // // データストアへ保存する
    //
    // // 同期化履歴レコードの初期化
    // WeiboMap retweetWeiboMap = new WeiboMap();
    // retweetWeiboMap.setSinaWeiboId(retweetedStatus.getId());
    // retweetWeiboMap.setTqqWeiboId(Long.valueOf(middleResponse.getData().getId()));
    // retweetWeiboMap.setUserMapId(null);
    // retweetWeiboMap.setSource(WeiboSource.Sina);
    // retweetWeiboMap.setStatus(WeiboStatus.SUCCESSED);
    // weiboMapDao.save(retweetWeiboMap);
    // retweetId = middleResponse.getData().getId();
    // }
    // }
    // if (retweetId != null) {
    // originalMsg = sinaWeiboApi.getOriginalMsg(status.getText().trim());
    // response = tqqWeiboApi.retweetMessage(retweetId, originalMsg,
    // status.getOriginal_pic(), null);
    // }
    //
    // } else { // 转发微博的处理 - END
    //

    // 普通微博的处理

    // originalMsg = sinaWeiboApi.getOriginalMsg(status.getText().trim());
    // response = tqqWeiboApi.sendMessage(status.getText().trim(),
    // status.getOriginal_pic(), null);
    // }

    status = sinaWeiboApi.updateStatus(msgData.getOrigtext(), null);

    } catch (Exception e) {
    throwable = e;
    }

    // 処理成功ならば、同期化レコードをデータストアへ保存する
    if (status != null) {

    // 同期成功情報を履歴レコードに反映
    weiboMap.setStatus(WeiboStatus.SUCCESSED);
    weiboMap.setSinaWeiboId(Long.valueOf(status.getId()));

    log.info("Tqq Message --> 同期化成功!!!");
    log.info("Tqq Message --> メッセージID:" + msgData.getId());

    } else {

    log.warning("Tqq Message --> 同期化失敗!!!");
    log.warning("Tqq Message --> メッセージID:" + msgData.getId());

    if (weiboMap.getId() != null) {
      weiboMap.setRetryCount(weiboMap.getRetryCount() + 1);
      // 失敗フラグを設定
      if (weiboMap.getRetryCount() >= Integer.valueOf(this.configMap.get("app.sync.message.max.retry"))) {
      weiboMap.setStatus(WeiboStatus.ABORT);
      } else {
      weiboMap.setStatus(WeiboStatus.FAILED);
      }
    } else {
      weiboMap.setStatus(WeiboStatus.FAILED);
    }

    String msg001 = "Tqq Message --> [" + msgData.getId() + "]メッセージをSinaへの送信が失敗しました。";
    log.severe(msg001);

    String errorDetail = throwable != null ? JSON.encode(throwable, true) : msgData.toString();
    log.severe(errorDetail);

    MailUtils.sendErrorReport(msg001 + "\n\n処理メッセージ:" + msgData.toString() + "\n\nSinaからのレスポンス:\n" + errorDetail + "\n\n");
    }

  } catch (Exception e) {

    String msg001 = "Tqq Message --> 同期化失敗しました、メッセージID:" + msgData.getId();
    log.severe(msg001);
    log.severe(JSON.encode(e, true));
    MailUtils.sendErrorReport(msg001 + "\n\n処理メッセージ:" + msgData.toString() + "\n\n例外:\n" + JSON.encode(e, true));
    // 例外が起きても次ぎのメッセージの同期化を行う
  } finally {
    // 同期化履歴レコードを保存する
    weiboMap = weiboMapDao.save(weiboMap);
    log.info("Tqq Message --> 同期化履歴レコードID:" + weiboMap.getId());
View Full Code Here

Examples of com.infiniteautomation.rq.MessageData

    super(address);
  }

  @Override
  protected Message createRequestMessage(NodeAddress address) {
    return new Message(address,'r',new MessageData(new char[]{'?'}));
  }
View Full Code Here

Examples of fysix.communication.msg.help.MessageData

   
    if(receiver instanceof MulticastUDPHandler){
      System.out.println("Multicast group");
    }
   
    MessageData md = new MessageData(data, size, MessageData.BIG_ENDIAN);
    while(size>0 && recSize<size){     
      String str = md.getString(0, 11); // TODO: Fix const!
     
      System.out.println("Received [" + recSize + "]: " + str + " , size = " + size);
     
      recSize += 11; // TODO: Fix const!
    }
View Full Code Here

Examples of fysix.communication.msg.help.MessageData

  //public int a      = 14;
  //public int b      = 41;
  public String str = "CODEMACHINE";
 
  public byte[] build() {
    MessageData msg = new MessageData(str.length(), MessageData.BIG_ENDIAN);
   
    //msg.add(a);
    //msg.add(b);   
    msg.add(str.getBytes());

    return msg.getMessage();
  }
View Full Code Here

Examples of fysix.communication.msg.help.MessageData

    return msg.getMessage();
  }
 
  public void parse(byte[] data) {
    MessageData msg = new MessageData(data, MessageData.BIG_ENDIAN);
   
    //a   = (int)msg.getInt();
    //b   = (int)msg.getInt();
    str = msg.getString(0,0); // Rest
  }
View Full Code Here

Examples of nl.clockwork.mule.ebms.model.ebxml.MessageData

    messageHeader.setService(new Service());
    messageHeader.getService().setType(sendingPartyInfo.getCollaborationRole().get(0).getServiceBinding().getService().getType());
    messageHeader.getService().setValue(sendingPartyInfo.getCollaborationRole().get(0).getServiceBinding().getService().getValue());
    messageHeader.setAction(sendingPartyInfo.getCollaborationRole().get(0).getServiceBinding().getCanSend().get(0).getThisPartyActionBinding().getAction());

    messageHeader.setMessageData(new MessageData());
    messageHeader.getMessageData().setMessageId(uuid + "@" + hostname);
    messageHeader.getMessageData().setRefToMessageId(context.getRefToMessageId());
    messageHeader.getMessageData().setTimestamp(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()));

    ReliableMessaging rm = CPAUtils.getReliableMessaging(cpa,messageHeader);
View Full Code Here

Examples of org.richfaces.application.push.MessageData

     */
    @Override
    public void clearBroadcastedMessages(long sequenceNumber) {
        Queue<MessageData> queue = messagesQueue;
        while (true) {
            MessageData message = queue.peek();
            if (message == null || sequenceNumber < message.getSequenceNumber()) {
                break;
            }

            queue.remove();
        }
View Full Code Here

Examples of org.richfaces.application.push.MessageData

     *
     * @see org.richfaces.application.push.Session#push(org.richfaces.application.push.TopicKey, java.lang.String)
     */
    @Override
    public void push(TopicKey topicKey, String serializedData) {
        MessageData serializedMessage = new MessageData(topicKey, serializedData, sequenceCounter.getAndIncrement());
        messagesQueue.add(serializedMessage);
        synchronized (this) {
            if (request != null) {
                request.postMessages();
            }
View Full Code Here

Examples of org.richfaces.application.push.MessageData

    public void appendScript(Appendable target) throws IOException {
        Iterator<MessageData> iterator = messages.iterator();

        while (iterator.hasNext()) {
            MessageData message = iterator.next();

            appendMessageToScript(message, target);

            // TODO - synchronization aids?
            lastMessageNumber = message.getSequenceNumber();
        }
    }
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.