Puts a message to ActiveMQ queue.

@param msg
@return
187247
protected boolean putToQueue(IQueueMessage<ID, DATA> msg) {
        try {
            BytesMessage message = getProducerSession().createBytesMessage();
            message.writeBytes(serialize(msg));
            getMessageProducer().send(message);
            return true;
        } catch (Exception e) {
            throw e instanceof QueueException ? (QueueException) e : new QueueException(e);
        }
    }
252078
@Override
    public boolean putLocked(AbstractMessage message, LocalSession session, MessageLockSet locks) throws JMSException
    {
    	checkNotClosed();
    	checkTransactionLock();
    	
    	// Consistency check
    	if (!message.isInternalCopy())
    		throw new FFMQException("Message instance is not an FFMQ internal copy !","CONSISTENCY_ERROR");
    	
    	// Dispatch message to the adequate store
    	MessageStore targetStore;
    	if (message.getJMSDeliveryMode() == DeliveryMode.NON_PERSISTENT)
    	{
    	    // Use volatile store if possible, otherwise fallback to persistent store
    	    targetStore = volatileStore != null ? volatileStore : persistentStore;
    	}
    	else
    	    targetStore = persistentStore;
    	    
    	if (targetStore == null)
    	    throw new FFMQException("Queue does not support this delivery mode : "+
    	                            (message.getJMSDeliveryMode() == DeliveryMode.NON_PERSISTENT ? 
    	                            "DeliveryMode.NON_PERSISTENT" : "DeliveryMode.PERSISTENT"),
    	                            "INVALID_DELIVERY_MODE");
    	
    	int newHandle;
        synchronized (storeLock)
        {
            newHandle = targetStore.store(message);
            if (newHandle == -1)
            {
            	// No space left for this message in the target store
            	if (targetStore == volatileStore && persistentStore != null && queueDef.isOverflowToPersistent())
            	{
            		// Fallback to persistent store if possible
            		targetStore = persistentStore;
            		newHandle = targetStore.store(message);
            	}
 
            	// Cannot store the message anywhere
            	if (newHandle == -1)
            		throw new DataStoreFullException("Cannot store message : queue is full : "+getName());
            }
            
            targetStore.lock(newHandle);
        	locks.add(newHandle, targetStore.getDeliveryMode(), this, message);
        }
        
        if (message.getJMSDeliveryMode() == DeliveryMode.PERSISTENT && requiresTransactionalUpdate())
        {
        	pendingChanges = true;
        	return true;
        }
        else
        	return false;
    }
1285991
@PUT
    @Consumes("application/json")
    public void putJson(IncomingMessage msg) {
        chatBean.addMessage(msg.nick, msg.content);
    }
1087670
Message toAmqpMessage() {
        final Message amqpMessage = Proton.message();

        if (this.properties != null && !this.properties.isEmpty()) {
            final ApplicationProperties applicationProperties = new ApplicationProperties(this.properties);
            amqpMessage.setApplicationProperties(applicationProperties);
        }

        if (this.systemProperties != null && !this.systemProperties.isEmpty()) {
            for (Map.Entry<String, Object> systemProperty : this.systemProperties.entrySet()) {
                final String propertyName = systemProperty.getKey();
                if (!EventDataUtil.RESERVED_SYSTEM_PROPERTIES.contains(propertyName)) {
                    if (AmqpConstants.RESERVED_PROPERTY_NAMES.contains(propertyName)) {
                        switch (propertyName) {
                            case AmqpConstants.AMQP_PROPERTY_MESSAGE_ID:
                                amqpMessage.setMessageId(systemProperty.getValue());
                                break;
                            case AmqpConstants.AMQP_PROPERTY_USER_ID:
                                amqpMessage.setUserId((byte[]) systemProperty.getValue());
                                break;
                            case AmqpConstants.AMQP_PROPERTY_TO:
                                amqpMessage.setAddress((String) systemProperty.getValue());
                                break;
                            case AmqpConstants.AMQP_PROPERTY_SUBJECT:
                                amqpMessage.setSubject((String) systemProperty.getValue());
                                break;
                            case AmqpConstants.AMQP_PROPERTY_REPLY_TO:
                                amqpMessage.setReplyTo((String) systemProperty.getValue());
                                break;
                            case AmqpConstants.AMQP_PROPERTY_CORRELATION_ID:
                                amqpMessage.setCorrelationId(systemProperty.getValue());
                                break;
                            case AmqpConstants.AMQP_PROPERTY_CONTENT_TYPE:
                                amqpMessage.setContentType((String) systemProperty.getValue());
                                break;
                            case AmqpConstants.AMQP_PROPERTY_CONTENT_ENCODING:
                                amqpMessage.setContentEncoding((String) systemProperty.getValue());
                                break;
                            case AmqpConstants.AMQP_PROPERTY_ABSOLUTE_EXPRITY_TIME:
                                amqpMessage.setExpiryTime((long) systemProperty.getValue());
                                break;
                            case AmqpConstants.AMQP_PROPERTY_CREATION_TIME:
                                amqpMessage.setCreationTime((long) systemProperty.getValue());
                                break;
                            case AmqpConstants.AMQP_PROPERTY_GROUP_ID:
                                amqpMessage.setGroupId((String) systemProperty.getValue());
                                break;
                            case AmqpConstants.AMQP_PROPERTY_GROUP_SEQUENCE:
                                amqpMessage.setGroupSequence((long) systemProperty.getValue());
                                break;
                            case AmqpConstants.AMQP_PROPERTY_REPLY_TO_GROUP_ID:
                                amqpMessage.setReplyToGroupId((String) systemProperty.getValue());
                                break;
                            default:
                                throw new RuntimeException("unreachable");
                        }
                    } else {
                        final MessageAnnotations messageAnnotations = (amqpMessage.getMessageAnnotations() == null)
                                ? new MessageAnnotations(new HashMap<>())
                                : amqpMessage.getMessageAnnotations();
                        messageAnnotations.getValue().put(Symbol.getSymbol(systemProperty.getKey()), systemProperty.getValue());
                        amqpMessage.setMessageAnnotations(messageAnnotations);
                    }
                }
            }
        }

        if (this.bodyData != null) {
            amqpMessage.setBody(new Data(this.bodyData));
        } else if (this.amqpBody != null) {
            if (this.amqpBody instanceof List) {
                amqpMessage.setBody(new AmqpSequence((List) this.amqpBody));
            } else {
                amqpMessage.setBody(new AmqpValue(this.amqpBody));
            }
        }

        return amqpMessage;
    }
142459
protected boolean putToQueue(IQueueMessage<ID, DATA> msg) {
        try {
            byte[] msgData = serialize(msg);
            getProducerChannel().basicPublish("", queueName, null, msgData);
            return true;
        } catch (Exception e) {
            throw e instanceof QueueException ? (QueueException) e : new QueueException(e);
        }
    }
1138961
private boolean takeMessage(SIMPMessage msg, boolean isOnItemStream)
                    throws SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "takeMessage", new Object[] { this, msg, Boolean.valueOf(isOnItemStream) });

        boolean msgTaken = false;

        // Put should only have been called if we said we were Ready but
        // we'll double check we are still Ready as there is a window where
        // we could have stopped/closed/ended the receive after the CD
        // had picked us from the ready list.
        if ((_ready && (_keyGroup == null)) || (_keyGroup != null) && (_keyGroup.isGroupReady()))
        {
            //Consumer is still ready so it can take the message
            //indicate that we're not Ready for any more messages
            //setReadyState(false);
            _ready = false;

            if (_keyGroup != null)
                _keyGroup.groupNotReady();

            // Before we can take the message we need to know that this consumer or its
            // ConsumerSet will allow it (they haven't reached their maxActiveMessage limits).
            // If they will accept it we have to, in the case of a ConsumerSet, 'reserve' the
            // space upfront because multiple members of the set could be concurrently adding
            // active messages. If this add happens to take the last available slot in the set's
            // quota it will keep the set write-locked for the duration of the message lookup. During
            // this time no other consumers in the set will be able to add any more messages.
            // This is done to ensure that the set's suspend/resume state is consistent and we don't
            // have to try to un-suspend consumers when we find there isn't a message to take after all.
            boolean msgAccepted = prepareAddActiveMessage();
            if (!msgAccepted)
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    SibTr.debug(tc, "The consumer set is already suspended ");
            }
            else
            {
                boolean activeMessageAttached = false;
                // Whatever the outcome we must commit or rollback the prepareAddActiveMessage()
                try
                {
                    //we HAVE taken this message
                    msgTaken = true;

                    //attach the message we have taken
                    try
                    {
                        activeMessageAttached = attachAndLockMsg(msg, isOnItemStream);
                    } catch (SIResourceException e)
                    {
                        // No FFDC code needed
                        SibTr.exception(tc, e);

                        activeMessageAttached = false;
                        checkWaiting();

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

                        throw e;
                    }

                    // We found an attached message, therefore we have another active
                    // message so commit the prepare we did above.
                    if (activeMessageAttached)
                        commitAddActiveMessage();

                    checkWaiting();
                } finally
                {
                    // If a message wasn't attached the commit won't have happened, instead
                    // roll back the prepare of the add, as if the prepare never happened.
                    if (!activeMessageAttached)
                        rollbackAddActiveMessage();
                }
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "takeMessage", Boolean.valueOf(msgTaken));

        return msgTaken;
    }
201183
private void runMessage(MessageAmp msg)
  {
    try (OutboxAmp outbox = OutboxAmpFactory.newFactory().get()) {
      outbox.inbox(msg.inboxTarget());
      outbox.message(msg);
      
      //RampActor systemActor = null;
      StubAmp systemActor = _stub;
      
      msg.invoke(InboxExecutorBase.this, systemActor);
      
      while (! outbox.flushAndExecuteLast()) {
      }
    }
  }
440123
@Override
    public void send(Message msg) throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "send", msg);

        //Defer straight through to the version with completion listner (which will do all the locking and checking).
        send_internal(msg, null);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "send");
    }
1314946
public function push(QueueMessage $message)
    {
        $queue = $message->getQueueName() ?: $this->queue;

        return $this->client->useTube($queue)->put(
            json_encode($message),
            PheanstalkInterface::DEFAULT_PRIORITY,
            $message->getDelay(),
            $this->timeout
        );
    }
573795
def put(self, message):
        
        if self.draining is False:
            self.drain()

        return self._enqueue(message)
224421
function() {
        activemq = new PodActiveMQ({
          username: params.queueUsername,
          password: params.queuePassword,
          host: params.queueHost,
          port: params.queuePort,
          timeout: params.queueConnectionTimeout
        });

        activemq.on("init", function() {
          fireEvent("asyncReady");

          socketState = socketStateType.OPEN;
          fireEvent("stateChange", {
            queueState: socketState
          });

          pushSendDataQueueHandler();

          activemq.subscribe({
            destination: params.queueReceive,
            ack: "client-individual"
          }, function(message) {
            handleSocketMessage(JSON.parse(message));
            if (onReceiveLogging) {
              asyncLogger("Receive", JSON.parse(message));
            }
          });

        });

        activemq.on("error", function(msg) {
          fireEvent("error", msg);

          socketState = socketStateType.CLOSED;

          fireEvent("stateChange", {
            queueState: socketState
          });
        })
      }
1219260
@SuppressWarnings("unchecked")
    public static UniversalIdIntQueueMessage newInstance() {
        Date now = new Date();
        UniversalIdIntQueueMessage msg = new UniversalIdIntQueueMessage();
        msg.setQueueTimestamp(now).setNumRequeues(0).setId(QueueUtils.IDGEN.generateId64())
                .setTimestamp(now);
        return msg;
    }
725320
def _sendMessage(self, msg):
        
        if not msg:
            return
        msg = self._collapseMsg(msg)
        self.sendStatus(msg)
301150
private javax.jms.Message messageHandler(MessageManager messageManager) throws JMSException {
        if (messageManager == null) {
            return null;
        }        
        javax.jms.Message message = messageManager.getMessage();
        
        // Notify PrefetchThread that message is dispatched
        this.messageDispatched();
        acknowledger.notifyMessageReceived((SQSMessage) message);
        return message;
    }
1348839
@Override
	public void send(Queue queue, Message message) throws JMSException
    {
        send((Destination)queue,message,defaultDeliveryMode,defaultPriority,defaultTimeToLive);
    }
703826
@Deprecated
    public boolean moveFromEphemeralToQueueStorage(IQueueMessage<ID, DATA> msg)
            throws QueueException.OperationNotSupported {
        throw new QueueException.OperationNotSupported(
                "This method is deprecated, use requeue() or requeueSilent() instead!");
    }
970200
public static function fromMessage(Message $msg)
    {
        $workerHandlerId = $msg->shift();
        $requestId = $msg->shift();
        if (!$requestId) {
            $requestId = null;
        }

        return new self($workerHandlerId, $requestId);
    }