biz.fstechnology.micro.server.jms.ResponseMessageCreator.java Source code

Java tutorial

Introduction

Here is the source code for biz.fstechnology.micro.server.jms.ResponseMessageCreator.java

Source

/*
 * @(#) biz.fstechnology.micro.server.jms.ResponseMessageCreator
 * Copyright (c) 2016 bBreak Systems Co, Ltd. All Rights Reserved.
 *
 * THE SOFTWARE IS PROVIDED BY bBreak Systems Co, Ltd.,
 * WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
 * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR
 * A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDER BE LIABLE FOR ANY
 * CLAIM, DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
 * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
 */
package biz.fstechnology.micro.server.jms;

import java.io.Serializable;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.ObjectMessage;
import javax.jms.Session;

import org.springframework.jms.core.MessageCreator;

import lombok.Getter;
import lombok.Setter;

/**
 * TODO Type Description
 * 
 * @author T.Maruyama
 * @since 2016/01/07
 */
public class ResponseMessageCreator implements MessageCreator {

    @Getter
    @Setter
    private Serializable contents;
    @Getter
    @Setter
    private String requestId;

    /**
     * @see org.springframework.jms.core.MessageCreator#createMessage(javax.jms.Session)
     */
    @Override
    public Message createMessage(Session session) throws JMSException {
        ObjectMessage message = session.createObjectMessage();
        message.setObject(getContents());
        message.setJMSCorrelationID(getRequestId());
        return message;

    }

}