Creates a DELIVERED message.

@param deliveredZxid the last zxid of delivered transaction.
@return a protobuf message.
13386
public static Message buildDelivered(Zxid deliveredZxid) {
    ZabMessage.Zxid zxid = toProtoZxid(deliveredZxid);
    ZabMessage.Delivered delivered =
      ZabMessage.Delivered.newBuilder().setZxid(zxid).build();
    return Message.newBuilder().setType(MessageType.DELIVERED)
                               .setDelivered(delivered).build();
  }
1279232
public void sendAckExpectedMessage(
    long ackExpStamp,
    int priority,
    Reliability reliability,
    SIBUuid12 stream)
    throws SIResourceException
  {

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(
        tc,
        "sendAckExpectedMessage",
        new Object[] {
          new Long(ackExpStamp),
          _targetMEUuid,
          new Integer(priority),
          reliability });

    ControlAckExpected ackexpMsg;
    try
    {
      ackexpMsg = _cmf.createNewControlAckExpected();
    }
    catch (Exception e)
    {
      // FFDC
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.impl.PubSubOutputHandler.sendAckExpectedMessage",
        "1:676:1.164.1.5",
        this);

      SibTr.exception(tc, e);
      SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
        new Object[] {
          "com.ibm.ws.sib.processor.impl.PubSubOutputHandler",
          "1:683:1.164.1.5",
          e });

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        SibTr.exit(tc, "sendAckExpectedMessage", e);

      throw new SIResourceException(
        nls.getFormattedMessage(
          "INTERNAL_MESSAGING_ERROR_CWSIP0002",
          new Object[] {
            "com.ibm.ws.sib.processor.impl.PubSubOutputHandler",
            "1:694:1.164.1.5",
            e },
          null),
        e);
    }

    // As we are using the Guaranteed Header - set all the attributes as 
    // well as the ones we want.
    SIMPUtils.setGuaranteedDeliveryProperties(ackexpMsg,
        _messageProcessor.getMessagingEngineUuid(), 
        null,
        stream,
        null,
        _destinationHandler.getUuid(),
        ProtocolType.PUBSUBINPUT,
        GDConfig.PROTOCOL_VERSION);
   
    ackexpMsg.setTick(ackExpStamp);
    ackexpMsg.setPriority(priority);
    ackexpMsg.setReliability(reliability);
    
    // SIB0105
    // Update the health state of this stream 
    InternalOutputStream sourceStream = (InternalOutputStream)_internalOutputStreamManager
                                              .getStreamSet(stream, false)
                                              .getStream(priority, reliability);
    if (sourceStream != null)
    {
      sourceStream.setLatestAckExpected(ackExpStamp);
      sourceStream.getControlAdapter()
        .getHealthState().updateHealth(HealthStateListener.ACK_EXPECTED_STATE, 
                                       HealthState.AMBER);
    }

    // If the destination in a Link add Link specific properties to message
    if( _isLink )
    {
      ackexpMsg = (ControlAckExpected)addLinkProps(ackexpMsg);
    }
    // Send ackExpected message to destination
    // Using MPIO

    //add a target cellule to the array for sending
    SIBUuid8[] fromTo = new SIBUuid8[1];
    fromTo[0] = _targetMEUuid;

    // Send the message to the MessageTransmitter
    _mpio.sendDownTree(fromTo,
                         priority,
                         ackexpMsg);


    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "sendAckExpectedMessage");

  }
180133
public static Message buildDiff(Zxid lastZxid) {
    ZabMessage.Zxid lz = toProtoZxid(lastZxid);

    Diff diff = Diff.newBuilder().setLastZxid(lz).build();

    return Message.newBuilder().setType(MessageType.DIFF)
                               .setDiff(diff)
                               .build();
  }
1196914
@Override
    public FacilityRejectedMessage createFRJ() {
        FacilityRejectedMessage msg = new FacilityRejectedMessageImpl(_FRJ_HOLDER.mandatoryCodes,
                _FRJ_HOLDER.mandatoryVariableCodes, _FRJ_HOLDER.optionalCodes, _FRJ_HOLDER.mandatoryCodeToIndex,
                _FRJ_HOLDER.mandatoryVariableCodeToIndex, _FRJ_HOLDER.optionalCodeToIndex);

        return msg;
    }
172198
public TrmMeBridgeBootstrapReply createNewTrmMeBridgeBootstrapReply() throws MessageCreateFailedException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createNewTrmMeBridgeBootstrapReply");
    TrmMeBridgeBootstrapReply msg = null;
    try {
      msg = new TrmMeBridgeBootstrapReplyImpl();
    }
    catch (MessageDecodeFailedException e) {
      /* No need to FFDC this as JsMsgObject will already have done so */
      // No FFDC code needed
      throw new MessageCreateFailedException(e);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createNewTrmMeBridgeBootstrapReply");
    return msg;
  }
338649
@Benchmark
  @BenchmarkMode(Mode.AverageTime)
  @OutputTimeUnit(TimeUnit.NANOSECONDS)
  public MessageEvent createMessageEvent(Data data) {
    return MessageEvent.builder(MessageEvent.Type.SENT, MESSAGE_ID).build();
  }
121173
public static Delivery newAlertMail(@NotNull Context ctx, @NotNull CharSequence title, @NotNull CharSequence message){
        // Create the delivery builder
        Delivery.Builder builder = newMail(ctx)
                .setTitle(title)
                .setMessage(message);

        // Return the delivery
        return builder.build();
    }
885157
private static String buildMessage(final String id) {
        if (id == null) {
            return NULL_MESSAGE;
        }

        return format(INVALID_MSG_FMT, id);
    }
292729
public MessageId newMessageId() {
        /*
         * use random into decimal representation
         */
        try {
            synchronized (random) {
                return new MessageId(String.format("%010d", random.nextInt(Integer.MAX_VALUE), 10));
            }
        } catch (PDUStringException e) {
            throw new RuntimeException("Failed creating message id", e);
        }
    }
1093089
public JsJmsBytesMessage createJmsBytesMessage() throws MessageCreateFailedException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsBytesMessage");
    JsJmsBytesMessage msg = null;
    try {
      msg = new JsJmsBytesMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
    }
    catch (MessageDecodeFailedException e) {
      /* No need to FFDC this as JsMsgObject will already have done so */
      // No FFDC code needed
      throw new MessageCreateFailedException(e);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsBytesMessage");
    return msg;
  }
503410
function(threadId, messageContent) {

                var message = formatDataToMakeMessage(threadId, messageContent);
                deliver({
                    messageId: message.id,
                    ownerId: message.participant.id
                });

                /**
                 * Add New Messages into cache database
                 */
                if (canUseCache) {
                    if (db) {
                        /**
                         * Insert new messages into cache database
                         * after deleting old messages from cache
                         */
                        var tempData = {};

                        try {
                            var salt = Utility.generateUUID();
                            tempData.id = parseInt(message.id);
                            tempData.owner = parseInt(userInfo.id);
                            tempData.threadId = parseInt(message.threadId);
                            tempData.time = message.time;
                            tempData.message = Utility.crypt(message.message, cacheSecret, salt);
                            tempData.data = Utility.crypt(JSON.stringify(unsetNotSeenDuration(message)), cacheSecret, salt);
                            tempData.salt = salt;
                            tempData.sendStatus = 'sent';

                        }
                        catch (error) {
                            fireEvent('error', {
                                code: error.code,
                                message: error.message,
                                error: error
                            });
                        }

                        db.messages.put(tempData)
                            .catch(function(error) {
                                fireEvent('error', {
                                    code: error.code,
                                    message: error.message,
                                    error: error
                                });
                            });
                    }
                    else {
                        fireEvent('error', {
                            code: 6601,
                            message: CHAT_ERRORS[6601],
                            error: null
                        });
                    }
                }

                fireEvent('messageEvents', {
                    type: 'MESSAGE_NEW',
                    result: {
                        message: message
                    }
                });

                if (fullResponseObject) {
                    getThreads({
                        threadIds: [threadId]
                    }, function(threadsResult) {
                        var threads = threadsResult.result.threads;

                        if (messageContent.participant.id !== userInfo.id && !threadsResult.cache) {
                            fireEvent('threadEvents', {
                                type: 'THREAD_UNREAD_COUNT_UPDATED',
                                result: {
                                    thread: threads[0],
                                    messageId: messageContent.id,
                                    senderId: messageContent.participant.id
                                }
                            });
                        }

                        if (!threadsResult.cache) {
                            fireEvent('threadEvents', {
                                type: 'THREAD_LAST_ACTIVITY_TIME',
                                result: {
                                    thread: threads[0]
                                }
                            });
                        }
                    });
                }
                else {
                    fireEvent('threadEvents', {
                        type: 'THREAD_LAST_ACTIVITY_TIME',
                        result: {
                            thread: threadId
                        }
                    });
                }

                /**
                 * Update waitQ and remove sent messages from it
                 */
                if (hasCache && typeof queueDb == 'object') {
                    queueDb.waitQ.where('uniqueId')
                        .equals(message.uniqueId)
                        .and(function(item) {
                            return item.owner == parseInt(userInfo.id);
                        })
                        .delete()
                        .catch(function(error) {
                            fireEvent('error', {
                                code: error.code,
                                message: error.message,
                                error: error
                            });
                        });
                }
                else {
                    for (var i = 0; i < chatSendQueue.length; i++) {
                        if (chatSendQueue[i].uniqueId == message.uniqueId) {
                            chatSendQueue.splice(i, 1);
                        }
                    }
                }
            }
724144
private ExecutionMessage createPendingExecutionMessage(Execution nextStepExecution) {
        // Take care of worker group
        String groupName = nextStepExecution.getGroupName();
        if (groupName == null) {
            groupName = WorkerNode.DEFAULT_WORKER_GROUPS[0];
        }
        return new ExecutionMessage(ExecutionMessage.EMPTY_EXEC_STATE_ID,
                ExecutionMessage.EMPTY_WORKER,
                groupName,
                executionMessage.getMsgId(),
                ExecStatus.PENDING,
                converter.createPayload(nextStepExecution),
                0).setWorkerKey(executionMessage.getWorkerKey());
    }
138646
public TrmClientAttachReply createNewTrmClientAttachReply() throws MessageCreateFailedException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createNewTrmClientAttachReply");
    TrmClientAttachReply msg = null;
    try {
      msg = new TrmClientAttachReplyImpl();
    }
    catch (MessageDecodeFailedException e) {
      /* No need to FFDC this as JsMsgObject will already have done so */
      // No FFDC code needed
      throw new MessageCreateFailedException(e);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createNewTrmClientAttachReply");
    return msg;
  }
241410
static Message readMessageFromDelivery(Receiver receiveLink, Delivery delivery)
	{
	    int msgSize = delivery.pending();
        byte[] buffer = new byte[msgSize];
        
        int read = receiveLink.recv(buffer, 0, msgSize);
        
        Message message = Proton.message();
        message.decode(buffer, 0, read);
        return message;	    
	}
863803
public Object buildMessagePayload(TestContext context, String messageType) {
        this.getMessageInterceptors().add(gzipMessageConstructionInterceptor);
        this.getMessageInterceptors().add(binaryMessageConstructionInterceptor);
        return getPayloadContent(context, messageType);
    }
1332906
public byte[] deliverSm(int sequenceNumber, String serviceType,
            byte sourceAddrTon, byte sourceAddrNpi, String sourceAddr,
            byte destAddrTon, byte destAddrNpi, String destinationAddr,
            byte esmClass, byte protocolId, byte priorityFlag,
            byte registeredDelivery, byte dataCoding, byte[] shortMessage,
            OptionalParameter... optionalParameters) throws PDUStringException {

        StringValidator.validateString(serviceType,
                StringParameter.SERVICE_TYPE);
        StringValidator.validateString(sourceAddr, StringParameter.SOURCE_ADDR);
        StringValidator.validateString(destinationAddr,
                StringParameter.DESTINATION_ADDR);
        StringValidator.validateString(shortMessage,
                StringParameter.SHORT_MESSAGE);

        PDUByteBuffer buf = new PDUByteBuffer(SMPPConstant.CID_DELIVER_SM, 0,
                sequenceNumber);
        buf.append(serviceType);
        buf.append(sourceAddrTon);
        buf.append(sourceAddrNpi);
        buf.append(sourceAddr);
        buf.append(destAddrTon);
        buf.append(destAddrNpi);
        buf.append(destinationAddr);
        buf.append(esmClass);
        buf.append(protocolId);
        buf.append(priorityFlag);
        buf.append((String)null); // schedule delivery time
        buf.append((String)null); // validity period
        buf.append(registeredDelivery);
        buf.append((byte)0); // replace if present flag
        buf.append(dataCoding);
        buf.append((byte)0); // sm default msg id
        buf.append((byte)shortMessage.length);
        buf.append(shortMessage);
        buf.appendAll(optionalParameters);
        ;
        return buf.toBytes();
    }
666425
public static Message buildPullTxnReq(Zxid lastZxid) {
    ZabMessage.Zxid zxid = toProtoZxid(lastZxid);

    PullTxnReq req = PullTxnReq.newBuilder().setLastZxid(zxid)
                                            .build();

    return Message.newBuilder().setType(MessageType.PULL_TXN_REQ)
                               .setPullTxnReq(req)
                               .build();
  }