当前位置: 首页>>代码示例>>Java>>正文


Java ObjectMessage.setObject方法代码示例

本文整理汇总了Java中javax.jms.ObjectMessage.setObject方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectMessage.setObject方法的具体用法?Java ObjectMessage.setObject怎么用?Java ObjectMessage.setObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.jms.ObjectMessage的用法示例。


在下文中一共展示了ObjectMessage.setObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendObjectMsgSingleSession

import javax.jms.ObjectMessage; //导入方法依赖的package包/类
private void sendObjectMsgSingleSession(List<? extends Serializable> objectsToSend) throws JMSException {
    Session session = null;
    Connection conn = null;
    try {
        conn = qFactory.createConnection();
        session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageProducer producer = session.createProducer(queue);
        for (Serializable objectToSend : objectsToSend) {
            ObjectMessage msg = session.createObjectMessage();
            msg.setObject(objectToSend);
            producer.send(msg);
        }
    } finally {
        closeSession(session);
        closeConnection(conn);
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:18,代码来源:TriggerQueueServiceBean.java

示例2: send

import javax.jms.ObjectMessage; //导入方法依赖的package包/类
/**
 * Sends a message to the myWMS application inside the application
 * server.
 * 
 * @param mfcMessage the message to be send
 * @throws JMSException
 * @throws NamingException
 */
public void send(MFCMessage mfcMessage)
    throws JMSException,
        NamingException
{

    // create the jms session
    QueueSession session =
        connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

    // lookup of the jms queue over jndi
    Queue outputQueue =
        (Queue) context.lookup("queue/" + OUTPUT_QUEUE_NAME);

    // create the message publisher
    QueueSender sender = session.createSender(outputQueue);

    ObjectMessage objectMessage = session.createObjectMessage();
    objectMessage.setObject(mfcMessage);
    objectMessage.setJMSTimestamp(System.currentTimeMillis());

    sender.send(objectMessage);
    sender.close();

    session.close();
}
 
开发者ID:salimvanak,项目名称:myWMS,代码行数:34,代码来源:ServerConnection.java

示例3: append

import javax.jms.ObjectMessage; //导入方法依赖的package包/类
/**
    This method called by {@link AppenderSkeleton#doAppend} method to
    do most of the real appending work.  */
 public void append(LoggingEvent event) {
   if(!checkEntryConditions()) {
     return;
   }

   try {
     ObjectMessage msg = topicSession.createObjectMessage();
     if(locationInfo) {
event.getLocationInformation();
     }
     msg.setObject(event);
     topicPublisher.publish(msg);
   } catch(Exception e) {
     errorHandler.error("Could not publish message in JMSAppender ["+name+"].", e,
		 ErrorCode.GENERIC_FAILURE);
   }
 }
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:21,代码来源:JMSAppender.java

示例4: append

import javax.jms.ObjectMessage; //导入方法依赖的package包/类
/**
 * This method called by {@link AppenderSkeleton#doAppend} method to do most of the real appending work.
 */
public void append(final LoggingEvent event) {
   if (!checkEntryConditions()) {
      return;
   }

   try {
      final ObjectMessage msg = topicSession.createObjectMessage();
      if (locationInfo) {
         event.getLocationInformation();
      }
      msg.setObject(event);
      topicPublisher.publish(msg);
   } catch (final Exception e) {
      errorHandler.error("Could not publish message in JMSAppender [" + name + "].", e,
              ErrorCode.GENERIC_FAILURE);
   }
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:21,代码来源:JMSAppender.java

示例5: append

import javax.jms.ObjectMessage; //导入方法依赖的package包/类
/**
 * This method called by {@link AppenderBase#doAppend} method to do most
 * of the real appending work.
 */
public void append(ILoggingEvent event) {
  if (!isStarted()) {
    return;
  }

  try {
    ObjectMessage msg = queueSession.createObjectMessage();
    Serializable so = pst.transform(event);
    msg.setObject(so);
    queueSender.send(msg);
    successiveFailureCount = 0;
  } catch (Exception e) {
    successiveFailureCount++;
    if (successiveFailureCount > SUCCESSIVE_FAILURE_LIMIT) {
      stop();
    }
    addError("Could not send message in JMSQueueAppender [" + name + "].", e);

  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:25,代码来源:JMSQueueAppender.java

示例6: publish

import javax.jms.ObjectMessage; //导入方法依赖的package包/类
public static void publish(String dest, Serializable object, String contentType, String tag) throws Exception {
   Connection conn = connectionFactory.createConnection();
   try {
      Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      Destination destination = createDestination(dest);
      MessageProducer producer = session.createProducer(destination);
      ObjectMessage message = session.createObjectMessage();

      if (contentType != null) {
         message.setStringProperty(HttpHeaderProperty.CONTENT_TYPE, contentType);
      }
      if (tag != null) {
         message.setStringProperty("MyTag", tag);
      }
      message.setObject(object);

      producer.send(message);
   } finally {
      conn.close();
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:22,代码来源:SelectorTest.java

示例7: jmsSendMessage

import javax.jms.ObjectMessage; //导入方法依赖的package包/类
private void jmsSendMessage(Serializable value, String destName, boolean isQueue) throws JMSException {
   ConnectionFactory factory = new ActiveMQJMSConnectionFactory("tcp://localhost:61616");
   String jmsDest;
   if (isQueue) {
      jmsDest = QUEUE_QUALIFIED_PREFIX + destName;
   } else {
      jmsDest = TOPIC_QUALIFIED_PREFIX + destName;
   }
   Destination destination = ActiveMQDestination.fromPrefixedName(jmsDest);

   Connection conn = factory.createConnection();
   try {
      Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageProducer producer = session.createProducer(destination);
      ObjectMessage message = session.createObjectMessage();
      message.setStringProperty(HttpHeaderProperty.CONTENT_TYPE, "application/xml");
      message.setObject(value);
      producer.send(message);
   } finally {
      conn.close();
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:23,代码来源:RestDeserializationTest.java

示例8: send

import javax.jms.ObjectMessage; //导入方法依赖的package包/类
@Override
public JMSProducer send(Destination destination, Serializable body) {
    try {
        ObjectMessage message = session.createObjectMessage();
        message.setObject(body);
        doSend(destination, message);
    } catch (JMSException jmse) {
        throw JMSExceptionSupport.createRuntimeException(jmse);
    }

    return this;
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:13,代码来源:JmsPoolJMSProducer.java

示例9: send

import javax.jms.ObjectMessage; //导入方法依赖的package包/类
@Override
public JMSProducer send(Destination destination, Serializable body) {
    try {
        ObjectMessage message = context.createObjectMessage();
        message.setObject(body);
        doSend(destination, message);
    } catch (JMSException jmse) {
        throw Utils.convertToRuntimeException(jmse);
    }
    return this;
}
 
开发者ID:ops4j,项目名称:org.ops4j.pax.transx,代码行数:12,代码来源:JMSProducerImpl.java

示例10: sendMessage

import javax.jms.ObjectMessage; //导入方法依赖的package包/类
private void sendMessage(String command, Serializable obj, String rashodCode) throws JMSException {
  ObjectMessage addMessage = session.createObjectMessage();
  addMessage.setStringProperty("operation", command);
  addMessage.setStringProperty("rashodCode", rashodCode);
  addMessage.setObject(obj);
  producer.send(addMessage);
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:8,代码来源:RecordManagerImpl.java

示例11: sendMessage

import javax.jms.ObjectMessage; //导入方法依赖的package包/类
public void sendMessage(ConnectionFactory connectionFactory, Queue queue, Serializable messageData) throws JMSException {
    Connection connection = connectionFactory.createConnection();
    Session session = connection.createSession(
            false,
            Session.AUTO_ACKNOWLEDGE);
    MessageProducer producer = session.createProducer(queue);
    ObjectMessage objectMessage = session.createObjectMessage();
    objectMessage.setObject(messageData);
    producer.send(objectMessage);
}
 
开发者ID:raidentrance,项目名称:ejb3.1-certification,代码行数:11,代码来源:MessageHelper.java

示例12: sendResponseMessage

import javax.jms.ObjectMessage; //导入方法依赖的package包/类
public void sendResponseMessage(Serializable object, String id) throws JMSException {
    ObjectMessage message = queuesession.createObjectMessage();
    message.setObject(object);
    if (id != null) {
        message.setJMSCorrelationID(id);
    }
    message.setJMSExpiration(3600 * 1000);
    producer.send(queue, message);
}
 
开发者ID:navisidhu,项目名称:libreacs,代码行数:10,代码来源:Jms.java

示例13: sendCallMessage

import javax.jms.ObjectMessage; //导入方法依赖的package包/类
public void sendCallMessage(Serializable object, String id, HostsLocal host/*String oui, String sn*/) throws JMSException {
    ObjectMessage msg = queuesession.createObjectMessage();
    msg.setJMSMessageID(id);
    msg.setJMSExpiration(3600 * 1000);
    msg.setObject(object);

    /*
    msg.setStringProperty("OUI", oui);
    msg.setStringProperty("SN", sn);
     */
    msg.setStringProperty("HWID", host.getHwid().toString());
    msg.setStringProperty("SN", host.getSerialno());

    producer.send(queue, msg);
}
 
开发者ID:navisidhu,项目名称:libreacs,代码行数:16,代码来源:Jms.java

示例14: putBackMessageOnIndexerQueue

import javax.jms.ObjectMessage; //导入方法依赖的package包/类
private boolean putBackMessageOnIndexerQueue(Message message) {
    if (message instanceof ObjectMessage) {
        Session session = null;
        Connection conn = null;
        try {
            Context jndiContext = getContext();
            ConnectionFactory qFactory = (ConnectionFactory) jndiContext
                    .lookup("jms/bss/indexerQueueFactory");
            conn = qFactory.createConnection();
            Queue queue = (Queue) jndiContext
                    .lookup("jms/bss/indexerQueue");
            session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
            MessageProducer producer = session.createProducer(queue);
            ObjectMessage msg = session.createObjectMessage();
            msg.setObject(((ObjectMessage) message).getObject());
            producer.send(msg);
            return true;
        } catch (Throwable e) {
            // This should not happen because the indexer queue is in the
            // local server. If it happens, than there's something terribly
            // wrong.
            throw new SaaSSystemException(e);
        } finally {
            closeSession(session);
            closeConnection(conn);
        }
    } else {
        return false;
    }
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:31,代码来源:IndexRequestListener.java

示例15: sendCompressedObjectMessageUsingOpenWire

import javax.jms.ObjectMessage; //导入方法依赖的package包/类
private void sendCompressedObjectMessageUsingOpenWire() throws Exception {
   Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
   ActiveMQDestination destination = createDestination(session, ActiveMQDestination.QUEUE_TYPE);

   final ActiveMQMessageProducer producer = (ActiveMQMessageProducer) session.createProducer(destination);

   ObjectMessage objectMessage = session.createObjectMessage();
   objectMessage.setObject(TEXT);

   producer.send(objectMessage);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:12,代码来源:CompressedInteropTest.java


注:本文中的javax.jms.ObjectMessage.setObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。