Vaya
Vaya

Reputation: 602

Hadoop MapReduce Program for sending Emails

I want to write a Mapreduce program that picks a file from the HDFS and send the same an attachment in the email.

Can you please help me with the structure of the code? Since its not like a typical file processing, should I have a Mapper and reducer ?

Ideally I wanted to use the Oozie SMTP Action but it doesnt support the attachments in the email.

Upvotes: 0

Views: 1043

Answers (2)

Kiran teja Avvaru
Kiran teja Avvaru

Reputation: 364

In this case whole content length as Longwritable type considered as Key, for the Mapper. And whole email content as Text type as Value, for the Mapper. writing above Key and Values to the context fix your problem. No. of Mapper = 1 No. of Reducers = 0 It works for you...!

Upvotes: 0

mross1080
mross1080

Reputation: 154

I'm not familiar with the Oozie SMTP Action part of the question but I can answer about the EMails.

One of the main paradigms of MapReduce is that you can implement any algorithm from a normal Java program in MapReduce. The difference between a normal Java file and MapReduce is being run on Hadoop, so you need to always emit a key-value pair from the mapper and reducer.

Therefore you can do whatever you want! Send an email, put it into a database, literally whatever you want as long as you emit a key-value pair from the mapper and reducer.

From what It sounds like you have a large data file with a lot of emails you want to send something to. Therefore you might want to use a Map only job. Since all you're doing is finding the email and sending an email, it doesn't seem like theres going to be an analysis or groupings done in a reducer, so you might be able to do a map only job.

Upvotes: 0

Related Questions