我遇到以下设置问题:
Java应用程序将电子邮件msg发送到JMS队列,然后侦听队列的MDB使用onMessage方法获取电子邮件msg,它在Gmail SMTP上打开连接,将电子邮件发送到SMTP并关闭连接.对JMS队列中的所有消息执行此操作.
当我在队列中同时拥有最多5条消息时,它工作得很好.5个不同的MDB实例同时拾取所有邮件,因此我有5个并发连接到Gmail SMTP服务器.但是当JMS队列中有更多消息时,我从Gmail SMTP服务器收到连接错误.5个第一个消息是正确发送的,但不是其余的,所以其他消息丢失,因为它们不再在队列中.
所以我的问题是,是否可以限制将侦听JMS队列的MDB实例的数量?如果我最多有5个MDB,那么即使队列中有1000个消息,也只需要更长的时间来清空队列,但至少我不会丢失任何消息.
任何其他建议来解决这个问题将非常感谢.
这是Jboss版本:
[服务器]版本ID:JBoss [Trinity] 4.2.3.GA(build:SVNTag = JBoss_4_2_3_GA date = 200807181417)
MDB的配置如下:
@MessageDriven(activationConfig = {
@ActivationConfigProperty( propertyName = "destinationType", propertyValue = "javax.jms.Queue" ),
@ActivationConfigProperty( propertyName = "destination", propertyValue = "queue/emailQueue")
})
Run Code Online (Sandbox Code Playgroud)
你需要更多吗?
谢谢
编辑2011-02-14
也许我想错误地限制MDB实例的数量.我看到了一个关于JMS线程数量的配置.如果我限制将发布到MDB的线程数,也许它会解决我的问题?在再次发布消息之前,JMS是否会等到MDB可用?这样做会有副作用吗?你虽然请.谢谢
结束编辑
我正在尝试使用EXTJS应用程序发送带附件的电子邮件.所以我有一个非常基本的表单,包括主题的文本字段,另一个带有inputType的文本字段:附件的'file'和一个html编辑器.
var panel = new Ext.form.FormPanel({
fileUpload:true,
labelAlign: 'right',
monitorValid: true,
border: false,
bodyBorder: false,
defaults:{
anchor: '100%',
labelStyle: 'font-weight:bold;'
},
items: [
{
xtype: 'textfield',
fieldLabel: 'SUBJECT',
name: 'subject',
allowBlank: false
},
{
xtype: 'textfield',
fieldLabel: 'ATTACHMENT',
name: 'file_to_upload',
anchor: '80%',
itemCls: 'attachment-field',
allowBlank: true,
inputType:'file'
},
{
xtype: 'htmleditor',
fieldLabel:'MESSAGE',
name:'msg'
}
]
});
Run Code Online (Sandbox Code Playgroud)
此表单放在一个窗口中,该窗口将提交给服务器:
var window = new Ext.Window({
title: 'Compose a message',
height: 600,
width: 800,
autoScroll: true,
border: false,
bodyBorder: false,
items: panel,
buttons:[
{ …Run Code Online (Sandbox Code Playgroud)