Examples of MessageResult


Examples of cn.jpush.api.MessageResult

    Map<String, Object> extra = new HashMap<String, Object>();
    IOSExtra iosExtra = new IOSExtra(10, "WindowsLogonSound.wav");
    extra.put("ios", iosExtra);

    //对所有用户发送通知, 更多方法请参考文档
    MessageResult msgResult = jpush.sendCustomMessageWithAppKey(sendNo,msgTitle, msgContent);
    //MessageResult msgResult  = jpush.sendNotificationWithAlias(sendNo, "a", msgTitle, msgContent);

    //覆盖指定msgId的消息,msgId可以从msgResult.getMsgid()获取。
    //MessageResult msgResult = jpush.sendNotificationWithAppKey(sendNo, msgTitle, msgContent, 0, extra,msgResult.getMsgid());


    if (null != msgResult) {
      System.out.println("服务器返回数据: " + msgResult.toString());
      if (msgResult.getErrcode() == ErrorCodeEnum.NOERROR.value()) {
        System.out.println(String.format("发送成功, sendNo= %s,messageId= %s",msgResult.getSendno(),msgResult.getMsg_id()));
      } else {
        System.out.println("发送失败, 错误代码=" + msgResult.getErrcode() + ", 错误消息=" + msgResult.getErrmsg());
      }
    } else {
      System.out.println("无法获取数据");
    }
View Full Code Here

Examples of cn.jpush.api.MessageResult

     * 通知、消息  两者区别。请参考:http://docs.jpush.cn/pages/viewpage.action?pageId=3309701
     */

   
    //对所有用户发送通知。
    MessageResult msgResult = jpush.sendNotificationWithAppKey(sendNo, msgTitle, msgContent);
   
    //对所有用户发送消息。
    //MessageResult msgResult = jpush.sendCustomMessageWithAppKey(sendNo,msgTitle, msgContent);
   
   
    //覆盖指定msgId的消息,msgId可以从msgResult.getMsgid()获取。
    //MessageResult msgResult = jpush.sendNotificationWithAppKey(sendNo, msgTitle, msgContent, 0, extra,msgResult.getMsgid());


    if (null != msgResult) {
      System.out.println("服务器返回数据: " + msgResult.toString());
      if (msgResult.getErrcode() == ErrorCodeEnum.NOERROR.value()) {
        System.out.println(String.format("发送成功, sendNo= %s,messageId= %s",msgResult.getSendno(),msgResult.getMsg_id()));
      } else {
        System.out.println("发送失败, 错误代码=" + msgResult.getErrcode() + ", 错误消息=" + msgResult.getErrmsg());
      }
    } else {
      System.out.println("无法获取数据");
    }

View Full Code Here

Examples of cn.jpush.api.MessageResult

  private final int DEFAULT_SOCKET_TIMEOUT = (30 * 1000); // milliseconds

  private static Gson gson = new Gson();

  public MessageResult sendPush(final String path, final boolean enableSSL, final MessageParams messageParams) {
    MessageResult messageResult = ValidateRequestParams.vidateParams(messageParams);
    if(messageResult != null) return messageResult;

    String pushResult = sendPost(path, enableSSL, parse(messageParams),RequestTypeEnum.PUSH.value(),null);
    return gson.fromJson(pushResult, MessageResult.class);
  }
View Full Code Here

Examples of cn.jpush.api.push.MessageResult

    //params.setReceiverType(ReceiverTypeEnum.REGISTRATION_ID);
    //params.setReceiverValue(registrationID);
    params.setReceiverType(ReceiverTypeEnum.TAG);
    params.setReceiverValue(tag);
   
    MessageResult msgResult = jpushClient.sendCustomMessage(msgTitle, msgContent, params, null);
        LOG.debug("responseContent - " + msgResult.responseResult.responseContent);
    if (msgResult.isResultOK()) {
          LOG.info("msgResult - " + msgResult);
          LOG.info("messageId - " + msgResult.getMessageId());
    } else {
        if (msgResult.getErrorCode() > 0) {
            // 业务异常
            LOG.warn("Service error - ErrorCode: "
                    + msgResult.getErrorCode() + ", ErrorMessage: "
                    + msgResult.getErrorMessage());
        } else {
            // 未到达 JPush
            LOG.error("Other excepitons - "
                    + msgResult.responseResult.exceptionString);
        }
View Full Code Here

Examples of org.apache.james.mailbox.MessageResult

                int j=0;
                Iterator<MessageResult> messageResultIterator = srcMessageManager.getMessages(MessageRange.all(), GROUP, srcMailboxSession);
               
                while (messageResultIterator.hasNext()) {

                    MessageResult messageResult = messageResultIterator.next();
                    InputStreamContent content = (InputStreamContent) messageResult.getFullContent();

                    dstMailboxManager.startProcessingRequest(dstMailboxSession);
                    dstMessageManager.appendMessage(content.getInputStream(), messageResult.getInternalDate(), dstMailboxSession, messageResult.getFlags().contains(Flag.RECENT), messageResult.getFlags());
                    dstMailboxManager.endProcessingRequest(dstMailboxSession);
                    log.info("Message #" + j + " appended in destination mailbox with path=" + mailboxPath.toString());
                    j++;

                }
View Full Code Here

Examples of org.apache.james.mailbox.MessageResult

    public MessageResult next() {
        if (hasNext() == false) {
            throw new NoSuchElementException("No such element.");
        }
        final Message<Id> message = messages.next();
        MessageResult result;
        try {

            result = ResultUtils.loadMessageResult(message, this.fetchGroup);
        } catch (MailboxException e) {
            result = new UnloadedMessageResult<Id>(message, e);
View Full Code Here

Examples of org.apache.james.mailbox.MessageResult

                    out.write((POP3Response.OK_RESPONSE + " Message follows\r\n").getBytes());
                    out.flush();
                    // response = new POP3Response(POP3Response.OK_RESPONSE,
                    // "Message follows");
                    try {
                        MessageResult result = results.next();

                        WritableByteChannel outChannel = Channels.newChannel(extraDotOut);

                        // write headers
                        Iterator<Header> headers = result.headers();
                        while (headers.hasNext()) {
                            headers.next().writeTo(outChannel);

                            // we need to write out the CRLF after each header
                            extraDotOut.write("\r\n".getBytes());

                        }
                        // headers and body are seperated by a CRLF
                        extraDotOut.write("\r\n".getBytes());

                        // write body
                        result.getBody().writeTo(Channels.newChannel(new CountingBodyOutputStream(extraDotOut, lines)));

                    } finally {
                        extraDotOut.flush();
                        // write a single dot to mark message as complete
                        out.write((".\r\n").getBytes());
View Full Code Here

Examples of org.apache.james.mailbox.MessageResult

                    out.flush();
                   
                    // response = new POP3Response(POP3Response.OK_RESPONSE,
                    // "Message follows");
                    try {
                        MessageResult result = results.next();
                        result.getFullContent().writeTo(Channels.newChannel(extraDotOut));

                    } finally {
                        extraDotOut.flush();
                       
                        // write a single dot to mark message as complete
View Full Code Here

Examples of org.apache.james.mailbox.MessageResult

        for (int i = 0; i < ranges.size(); i++) {
            mailbox.getMessages(ranges.get(i), resultToFetch, mailboxSession, new MessageCallback() {

                public void onMessages(Iterator<MessageResult> it) throws MailboxException {
                    while (it.hasNext()) {
                        final MessageResult result = it.next();
                        try {
                            final FetchResponse response = builder.build(fetch, result, mailbox, session, useUids);
                            responder.respond(response);
                        } catch (ParseException e) {
                            // we can't for whatever reason parse the message so
                            // just skip it and log it to debug
                            session.getLog().debug("Unable to parse message with uid " + result.getUid(), e);
                        } catch (MessageRangeException e) {
                            // we can't for whatever reason find the message so
                            // just skip it and log it to debug
                            session.getLog().debug("Unable to find message with uid " + result.getUid(), e);
                        }
                    }
                }
            });
        }
View Full Code Here

Examples of org.apache.james.mailbox.MessageResult

                        } else {
                            results = session.getUserMailbox().getMessages(MessageRange.one(uidList.get(0)), new FetchGroupImpl(FetchGroup.MINIMAL), mailboxSession);
                        }

                        while (results.hasNext()) {
                            MessageResult result = results.next();
                            if (deletedUidList.contains(result.getUid()) == false) {
                                size += result.getSize();
                                count++;
                                validResults.add(result);
                            }
                        }
                    }
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.