Storing object in spark streaming

2015-10-12 Thread Something Something
In my custom receiver for Spark Streaming I've code such as this:

messages.toArray().foreach(msg => {
  val m = msg.asInstanceOf[Message]
*  store(m.getBody)*
})

Instead of 'body' which is of type 'String', I would rather pass the entire
Message object, but when I say store(m), I get a compiler error saying:
"Cannot resolve reference store with such signature"

But I see this method in 'Receiver.scala':

  def store(dataItem: T) {
executor.pushSingle(dataItem)
  }


How do I store the entire object? Please help. Thanks.


Re: Storing object in spark streaming

2015-10-12 Thread Jeff Nadler
Your receiver must extend Receiver[String].Try changing it to extend
Receiver[Message]?

On Mon, Oct 12, 2015 at 2:03 PM, Something Something <
mailinglist...@gmail.com> wrote:

> In my custom receiver for Spark Streaming I've code such as this:
>
> messages.toArray().foreach(msg => {
>   val m = msg.asInstanceOf[Message]
> *  store(m.getBody)*
> })
>
> Instead of 'body' which is of type 'String', I would rather pass the
> entire Message object, but when I say store(m), I get a compiler error
> saying: "Cannot resolve reference store with such signature"
>
> But I see this method in 'Receiver.scala':
>
>   def store(dataItem: T) {
> executor.pushSingle(dataItem)
>   }
>
>
> How do I store the entire object? Please help. Thanks.
>
>
>
>