/** 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(JMSException e) { errorHandler.error("Could not publish message in JMSAppender ["+name+"].", e, ErrorCode.GENERIC_FAILURE); } catch(RuntimeException e) { errorHandler.error("Could not publish message in JMSAppender ["+name+"].", e, ErrorCode.GENERIC_FAILURE); } }
/** * 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); } }
/** * 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 = topicSession.createObjectMessage(); Serializable so = pst.transform(event); msg.setObject(so); topicPublisher.publish(msg); successiveFailureCount = 0; } catch (Exception e) { successiveFailureCount++; if (successiveFailureCount > SUCCESSIVE_FAILURE_LIMIT) { stop(); } addError("Could not publish message in JMSTopicAppender [" + name + "].", e); } }
/** 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(JMSException e) { errorHandler.error("Could not publish message in JMSAppender ["+name+"].", e, ErrorCode.GENERIC_FAILURE); } catch(RuntimeException e) { errorHandler.error("Could not publish message in JMSAppender ["+name+"].", e, ErrorCode.GENERIC_FAILURE); } }
public void setObject(Serializable object) throws JMSException { ((ObjectMessage) message).setObject(object); } }
/** * @param object * @return ObjectMessage * @throws JMSException * @see javax.jms.Session#createObjectMessage(java.io.Serializable) */ public ObjectMessage createObjectMessage(Serializable object) throws JMSException { ObjectMessage result = createObjectMessage(); result.setObject(object); return result; }
protected void sendNotification(ClusterNotification message) { try { ObjectMessage objectMessage = publisherSession.createObjectMessage(); objectMessage.setObject(message); //sign the message, with the name of this node objectMessage.setStringProperty("nodeName", clusterNode); messagePublisher.send(objectMessage); } catch (JMSException e) { log.error("Cannot send notification " + message, e); } }
protected Message createJMSMessage(Serializable obj, Session session) throws JMSException { if (obj instanceof String) { TextMessage textMsg = session.createTextMessage(); textMsg.setText((String) obj); return textMsg; } else { ObjectMessage objMsg = session.createObjectMessage(); objMsg.setObject(obj); return objMsg; } }
public ObjectMessage createMessage(Serializable body, Map<String, Object> properties) { ObjectMessage message = this.createObjectMessage(); if (body != null) { try { message.setObject(body); } catch (JMSException jmsEx) { throw new EmbeddedJMSResourceException(String.format("Failed to set body {%s} on ObjectMessage", body.toString()), jmsEx); } } setMessageProperties(message, properties); return message; }
public ObjectMessage createMessage(Serializable body, Map<String, Object> properties) { ObjectMessage message = this.createObjectMessage(); if (body != null) { try { message.setObject(body); } catch (JMSException jmsEx) { throw new EmbeddedJMSResourceException(String.format("Failed to set body {%s} on ObjectMessage", body.toString()), jmsEx); } } setMessageProperties(message, properties); return message; }
public ObjectMessage createMessage(Serializable body, Map<String, Object> properties) throws JMSException { ObjectMessage message = this.createObjectMessage(); if (body != null) { message.setObject(body); } setMessageProperties(message, properties); return message; }
protected void sendNotification(ClusterNotification message) { try { ObjectMessage objectMessage = publisherSession.createObjectMessage(); objectMessage.setObject(message); //sign the message, with the name of this node objectMessage.setStringProperty("nodeName", clusterNode); publisher.publish(objectMessage); } catch (JMSException e) { log.error("Cannot send notification " + message, e); } } }
@Override protected void prepareMessage(final Message m) throws JMSException { super.prepareMessage(m); ObjectMessage om = (ObjectMessage) m; om.setObject("this is the serializable object"); }
@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; }
Master eMaster = new Master(); eMaster.setF(); //add Files here QueueSender queueSender = queueSession.createSender(queue1); ObjectMessage objMessage = queueSession.createObjectMessage(); objMessage.setObject(eMaster); queueSender.send(objMessage);
@Test public void testVectorOnObjectMessage() throws Exception { java.util.Vector<String> vectorOnMessage = new java.util.Vector<>(); vectorOnMessage.add("world!"); ((ObjectMessage) message).setObject(vectorOnMessage); queueProd.send(message); ObjectMessage r = (ObjectMessage) queueCons.receive(5000); ProxyAssertSupport.assertNotNull(r); java.util.Vector v2 = (java.util.Vector) r.getObject(); ProxyAssertSupport.assertEquals(vectorOnMessage.get(0), v2.get(0)); }
void sendObjectMessage(Serializable obj, Map properties) throws JMSException { if (obj == null) return; ObjectMessage message = session.createObjectMessage(); message.setObject(obj); copyHeadersToProperties(properties, message); publisher.publish(message, getDeliveryMode(), messagePriority, getTimeToLive(properties)); }
void sendObjectMessage(Serializable obj, Map properties) throws JMSException { if (obj != null) { ObjectMessage message = session.createObjectMessage(); message.setObject(obj); copyHeadersToProperties(properties, message); long timeToLive = getTimeToLive(properties); sender.send(message, getDeliveryMode(), messagePriority, timeToLive); } } }
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); }
private void sendMessage(List<LuceneWork> queue) throws Exception { ObjectMessage message = getQueueSession().createObjectMessage(); final String indexName = getIndexName(); message.setStringProperty( Environment.INDEX_NAME_JMS_PROPERTY, indexName ); byte[] data = getExtendedSearchIntegrator().getWorkSerializer().toSerializedModel( queue ); message.setObject( data ); QueueSender sender = getQueueSession().createSender( getMessageQueue() ); sender.send( message ); }