使用JmsTemplate傳送持久化和非持久化訊息

2021-06-20 10:44:07 字數 970 閱讀 5519

由於jmstemplate內部傳送訊息預設為持久化的,所以不用設定即可傳送持久化訊息。

如果要傳送非持久化的訊息,請按照以下配置即可:

對於傳送非持久化訊息需要配置explicitqosenabled該屬性為true,否則spring內部傳送訊息時將採用預設配置進行傳送訊息,

而spring內部預設為持久化傳送,所以上述屬性必須設定為true,當設定為true時,外部設定的屬性才可以使用。

下面為屬性explicitqosenabled的注釋資訊,如下:

/**

* if "true", then the values of deliverymode, priority, and timetolive

* will be used when sending a message. otherwise, the default values,

* that may be set administratively, will be used.

* @return true if overriding default values of qos parameters

* (deliverymode, priority, and timetolive)

* @see #setdeliverymode

* @see #setpriority

* @see #settimetolive

*/public boolean i***plicitqosenabled()

下面是傳送訊息的地方,如下**所示:

protected void dosend(messageproducer producer, message message) throws jm***ception 

else

}

SendMail 傳送測試 使用

extern c declspec dllimport dword setmailinfo char subject,char context,char filename extern c declspec dllimport dword setmaildest char mailname exte...

使用spring傳送郵件

最近想做乙個 註冊那部分想做成將密碼資訊傳送到客戶郵件中的那種,隨即翻了翻資料做了個例子 建立乙個配置檔案bean.xml,內容如下 tp驗證 true f9inux gmail.com flatfish93 163.com hello ghjgjhghghghgjhgjgjhgj 上面那一部分寫的...

使用Linux傳送郵件

系統收到郵件都會儲存在 var spool mail linux 使用者名稱 檔案中。在 linux 中輸入mail 就進行了收件箱,並顯示二十封郵件列表。此時命令提示符為 unread 標記為未讀郵件 h headers 顯示當前的郵件列表 l list 顯示當前支援的命令列表 help 顯示多個...