1 2 Previous Next 27 Replies Latest reply on Sep 11, 2008 11:37 AM by stlecho

    SMTP/POP Provider


      I´m looking for a SMTP/POP Provider. Is there any previous experience ?

      I think It should be an standard provider like SQL and FTP Providers.

      If there´s nothing I´ll be developing it. It´s a perfect example about wrapping an email into JMS.... and process it with all the integrated tools.

      Thanks,
      Eric

        • 1. Re: SMTP/POP Provider
          burrsutter

          We didn't get this feature in place, didn't document it and didn't provide an example for it. However, if you have the Java code need to POP an email account (and an email server ready to make the attempt) then just drop that code into quickstart scheduled_services/src\org\jboss\soa\esb\samples\quickstart\scheduler
          MyScheduledActionMsgComposer.java

          I was trying to get this done in time for the GA release but just ran out of gas. You can use the scheduled service as a template for POP/email polling as well as RSS polling. Johan even sent me the code for POP and I still didn't finish.

          Note: the only trick may be that your POP code will return multiple email messages. If this is the case, attach them as a list in the composer class to the message (which is sent into the action chain), then in the first action, loop through the list and use the ServiceInvoker to start a new service on each email message.

          For SMTP (messaging sending, POP for receiving), you'll just need to copy and paste your code into an Action.

          Burr

          • 2. Re: SMTP/POP Provider


            Ok !

            If I have more questions, I'll be posting them.

            Thanks,
            Erik

            • 3. Re: SMTP/POP Provider


              Burr,

              I was working ... three questions:

              1. I'm working with scheduled_service to define the provider...., at the end .. Can I define specialized bus-provider type ? For example pop-provider. How ? I can't find where the other providers are defined.

              2. About returning multiple email messages in the composer class, is the reason that the composer class can only send one message "public Message composeMessage() throws SchedulingException" ?

              3. To pack the list, do you have one example ? I'm thinking to do it, in this way:
              for( Iterator iter = ....iterator(); iter.hasNext();) {
              ....
              myMessage.getBody().add(object.getId(), object.toString());
              }

              Thanks,
              Eric

              • 4. Re: SMTP/POP Provider
                burrsutter

                 


                1. I'm working with scheduled_service to define the provider...., at the end .. Can I define specialized bus-provider type ? For example pop-provider. How ? I can't find where the other providers are defined.


                I'm not sure how to do this or even if it is possible. Perhaps one of the other team members can jump in and respond. Worst case is that you'll work with the schedule provider.


                2. About returning multiple email messages in the composer class, is the reason that the composer class can only send one message "public Message composeMessage() throws SchedulingException" ?

                The reason the composer only creates a single message is because you can only feed one message at a time into the action pipeline. Therefore just hang your whole list on the message with something like:
                message.getBody().add("emailMsgs",mylist);


                3. To pack the list, do you have one example ? I'm thinking to do it, in this way:
                for( Iterator iter = ....iterator(); iter.hasNext();) {
                ....
                myMessage.getBody().add(object.getId(), object.toString());
                }


                that should work. You then have each individual email message hung off of the message object.

                You then need to write a custom action that pulls them individually back out again. Now, I've made assumption that you really have 2 ESB services that you are creating. One is the for the polling and one for the processing. The schedule-based one is the poller. The 2nd one is called from the poller's custom action via the ServiceInvoker. You can find an example of the ServiceInvoker in the helloworld, exceptions_faults and custom_action quickstarts.

                Unless you just wish to process all the email messages in a "batch" in which case just pass the list around from action to action or service to service via that message object.

                Perhaps you can donate this back as a quickstart to demonstrate STMP polling! :-)


                Burr

                • 5. Re: SMTP/POP Provider


                  Burr,

                  Did you mean POP polling ? Yeah, no problem, give me a few days.

                  Thanks,
                  Eric

                  • 6. Re: SMTP/POP Provider
                    burrsutter

                    Yes! Sorry about that.

                    • 7. Re: SMTP/POP Provider
                      marklittle

                      BTW, let's not forget JCA and the fact JBoss JCA has email inflow support.

                      • 8. Re: SMTP/POP Provider
                        burrsutter

                        I have thought about that but we've not seen it work yet. Someone will need to spend some time verifying it.

                        The JCA gateway is documented in the ESB Programmers Guide but it shows the use of JMS.

                        JCA + Email is shown here from the AS perspective:
                        http://wiki.jboss.org/wiki/Wiki.jsp?page=InboundJavaMail

                        I've not had the time to combine the two approaches and I don't believe the email JCA stuff is checked into the ESB codebase at this time, therefore, the scheduled listener was the easiest approach (IMO). Perhaps I just missed something someplace.


                        Burr

                        • 9. Re: SMTP/POP Provider
                          marklittle

                           

                          "burrsutter" wrote:
                          I have thought about that but we've not seen it work yet. Someone will need to spend some time verifying it.


                          Well we know it works in general, because Seam is using it AFAIK. Bill also recommended it.


                          The JCA gateway is documented in the ESB Programmers Guide but it shows the use of JMS.

                          JCA + Email is shown here from the AS perspective:
                          http://wiki.jboss.org/wiki/Wiki.jsp?page=InboundJavaMail

                          I've not had the time to combine the two approaches and I don't believe the email JCA stuff is checked into the ESB codebase at this time,


                          I was under the impression it was going to be shipped with AS itself. Could be wrong though. I'll check when I get back from vacation.


                          therefore, the scheduled listener was the easiest approach (IMO). Perhaps I just missed something someplace.


                          In general, before we go developing any more gateways we should look at what's available off the shelf. It could save us a lot of time and support headaches.

                          • 10. Re: SMTP/POP Provider
                            arutha


                            Funny story.. I wrote an app for both SMTP and POP3 a month ago, half a SMTPserver(the listening part) and a POP3 puller, both forwarding it to the gateway.

                            I'm fairly happy there's going to be a standard provider for these protocols & am looking forward to the results.

                            • 11. Re: SMTP/POP Provider

                              I think that an smtp gateway is a real need and it would be very interresting having it.
                              We have the same need. We're planning to migrate our integration platform using soa aproach with jbossESB (or other equivalent product). we are recieving files to integrate in our sytem from jms,mail,ftp.
                              The only missing thing that meet our need is the smtp gateway.
                              I'm starting tu use jbossESB and it's too early for me starting gateway developpement.
                              I concentrate my effort understanding all good things that are availlable with this product.
                              But I think that the first thing I would do(if i could) is to bring smtp gateway in the gataway staff.
                              Meissa


                              In general, before we go developing any more gateways we should look at what's available off the shelf. It could save us a lot of time and support headaches.


                              • 12. Re: SMTP/POP Provider
                                burrsutter

                                Do you mean an POP gateway?

                                SMTP is more for sending emails (out of the bus) while POP would be more for receiving emails. With that said, perhaps you want the ESB to itself be an email server which is not something I think we intend to do. Much like the FTP provider, you setup and configure another 3rd party FTP server and we poll it for new files.

                                • 13. Re: SMTP/POP Provider
                                  kconner

                                  Don't use the JCA inflow at the moment, it isn't working.

                                  I have just gone through the steps to configure this and discovered two issues, one related to our JCA code and another with juddi.

                                  I'll log JIRAs for these over the weekend.

                                  • 14. Re: SMTP/POP Provider
                                    marklittle

                                    If you get a chance, try the email inflow when it's all working again ;-)

                                    1 2 Previous Next