package cn.sagacloud.server.algorithm.services.activemq

import org.apache.activemq.command.ActiveMQTopic
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.jms.core.JmsMessagingTemplate
import org.springframework.stereotype.Component
import javax.jms.Destination

/**
 *
 *
 * @author jxing
 */
@Component
class JMSProducer {

    @Autowired
    lateinit var jmsTemplate : JmsMessagingTemplate

    val destination = ActiveMQTopic("model.manage")

    fun sendMessage(destination : Destination, message : String){
        jmsTemplate.convertAndSend(destination, message)
    }

    fun sendMessage(message : String){
        jmsTemplate.convertAndSend(destination, message)
    }
}