Glassfish 电子邮件服务是一个不错的选择吗?
我已经在我的应用程序中达到了我想从中发送电子邮件的程度。我发现这个网页描述了GlassFish 如何拥有一个让容器为您处理一切的设施。
或者,我可以编写自己的 Thread 代码,该线程从 BlockingQueue 获取作业并构造其自己的 javax.mail.Session 对象。实际上我已经做到了这一点并且似乎有效。实际上并没有那么复杂,我已将所有 javax.mail. 导入合并到一个类中。
问题是:使用 GlassFish 服务我能获得任何有价值的优势吗?
我唯一能想到的是 GlassFish 提供了一个电子邮件配置实用程序(什么服务器、身份验证等)。我的网络应用程序已经为管理员用户提供了这种能力,所以这对我来说不是什么大问题。
除此之外,如果我使用它,我的应用程序是否会连接到 GlassFish,以便在需要时将问题移植到其他容器?
非常感谢所有去过那里的人能够分享他们的经验。
I have gotten to the point in my application where I want to send e-mail from it. I found this web page that describes how GlassFish has a facility where you can let the container handle everything for you.
Alternatively, I can code my own Thread that takes jobs from a BlockingQueue and constructs and its own javax.mail.Session object. I have actually already done this and it seems to work. It is really not that much more complicated and I have combined all the javax.mail. imports to just one class.
The question is this: do I get any worthwhile advantage by using the GlassFish service?
The only one I can think of is that GlassFish provides a configuration utility for the e-mail (what server, authentication, etc.). My web-app already has that ability for the admin user, so that isn't a big deal for me.
Beyond that if I use it, does my application become wired into GlassFish so I have porting problems to other containers if I ever have the need?
Much thanks to anyone who has been there who can share their experience.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这基本上与好或坏的选择无关。 javax.mail 是内置的,它提供了处理邮件所需的一切。
如果您在任何应用程序服务器中使用 Thread 和 BlockingQueue,您最终将不得不使用 JCA,因为其他所有内容都会违反 java ee 规范。因此,使用提供的邮件设施在应用程序服务器上运行它始终是正确的选择。
据我所知,javax.mail 以及与 GlassFish 的集成并没有什么神奇之处。没有什么反对使用它...
This basically isn't about good or bad choices. The javax.mail stuff is build in and provides everything you need for handling mails.
If you play around with Thread and BlockingQueue in any application server you would end up having to use a JCA because everything else would break the java ee spec. So, running this on an application server using the provided mail facilities always is the right choice.
As far as I know there is no magic involved with javax.mail and the integration with GlassFish. Nothing against using it ...