Glassfish 电子邮件服务是一个不错的选择吗?

发布于 2024-12-09 19:31:35 字数 615 浏览 0 评论 0原文

我已经在我的应用程序中达到了我想从中发送电子邮件的程度。我发现这个网页描述了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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

洒一地阳光 2024-12-16 19:31:35

这基本上与好或坏的选择无关。 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 ...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文