[GoatRodeo] Stambecco / Commting to Database

1 view
Skip to first unread message

Jay

unread,
May 3, 2010, 3:00:14 PM5/3/10
to Goat Rodeo
I'm having issues committing data into the database using Stambecco.
I'm using the Skittr code as an example. When I'm debugging I get the
following message:

" 2010-05-03 11:41:07,235 [pool-2-thread-7] DEBUG
net.liftweb.mapper.MetaMapper - Saving dbName=Message,
entity=com.echo.model.Message=postedBy=1,SourceUrl=,Latitude=,Longitude=,messageId=0,id=-1,Source=web,Body=loop,Created=Mon,
3 May 2010 17:41:07 UTC} "

but when I query the database that row does not exists.

The following is the code I use to get the UserWorker:

val userWorker = WorkerMgr find UserId(currentUserDetails.userId)
openOr null
userWorker ! PostUpdate(id, msg, "web", new Date())

Pretty much from here it is similiar to the skittr example code calls,
doUpdate, then doAddUpdate

Any help is appreciated.

--
You received this message because you are subscribed to the Google Groups "Goat Rodeo" group.
To post to this group, send email to goat-...@googlegroups.com.
To unsubscribe from this group, send email to goat-rodeo+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/goat-rodeo?hl=en.

David Pollak

unread,
May 3, 2010, 3:25:34 PM5/3/10
to goat-...@googlegroups.com
Jay,

I'll do some coding to try to reproduce the issue.  Hopefully I'll get to it tonight california time.

Thanks,

David
--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

David Pollak

unread,
May 4, 2010, 12:24:43 AM5/4/10
to goat-...@googlegroups.com
On Mon, May 3, 2010 at 12:00 PM, Jay <cain...@gmail.com> wrote:
I'm having issues committing data into the database using Stambecco.
I'm using the Skittr code as an example.  When I'm debugging I get the
following message:

" 2010-05-03 11:41:07,235 [pool-2-thread-7] DEBUG
net.liftweb.mapper.MetaMapper - Saving dbName=Message,
entity=com.echo.model.Message=postedBy=1,SourceUrl=,Latitude=,Longitude=,messageId=0,id=-1,Source=web,Body=loop,Created=Mon,
3 May 2010 17:41:07 UTC} "

but when I query the database that row does not exists.

When you say "I query the database", do you mean from within the Worker or from outside the Worker?

Each Worker has its own separate database instance.  Whatever a Worker writes to its database instance is visible only to that Worker.

So, basically, the only way to get data out of a Worker is to do an ask/answer.

I've updated the harness to demonstrate putting data in and getting data out.

Do an mvn clean install, then cd into examples/stambecco-example-skittr and type "mvn jetty:run"  In a separate window, cd into harness and then type "sbt"  From the sbt command line, type "run user1" then "run user2"  Add a message to user1, type "run -m 1" which will add a message to the timeline of user1.  Next, in your browser, browse to http://localhost:8080/timeline/1 You'll see the timeline for user1.  

Please give it a try and see if it works for you.

Thanks,

David

 

The following is the code I use to get the UserWorker:

 val userWorker = WorkerMgr find UserId(currentUserDetails.userId)
openOr null
 userWorker ! PostUpdate(id, msg, "web", new Date())

Pretty much from here it is similiar to the skittr example code calls,
doUpdate, then doAddUpdate

Any help is appreciated.

--
You received this message because you are subscribed to the Google Groups "Goat Rodeo" group.
To post to this group, send email to goat-...@googlegroups.com.
To unsubscribe from this group, send email to goat-rodeo+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/goat-rodeo?hl=en.


--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

Jay

unread,
May 4, 2010, 2:49:42 AM5/4/10
to Goat Rodeo
When a make a query on the db, it is outside of the worker, but i
thought that when you save a Mapper object it persists to the backend
storage, which in my case is a RDMS. I will try the harness.

Thxs

On May 3, 10:24 pm, David Pollak <feeder.of.the.be...@gmail.com>
wrote:
> On Mon, May 3, 2010 at 12:00 PM, Jay <cain....@gmail.com> wrote:
> > I'm having issues committing data into the database using Stambecco.
> > I'm using the Skittr code as an example.  When I'm debugging I get the
> > following message:
>
> > " 2010-05-03 11:41:07,235 [pool-2-thread-7] DEBUG
> > net.liftweb.mapper.MetaMapper - Saving dbName=Message,
>
> > entity=com.echo.model.Message=postedBy=1,SourceUrl=,Latitude=,Longitude=,messageId=0,id=-1,Source=web,Body=loop,Created=Mon,
> > 3 May 2010 17:41:07 UTC} "
>
> > but when I query the database that row does not exists.
>
> When you say "I query the database", do you mean from within the Worker or
> from outside the Worker?
>
> Each Worker has its own separate database instance.  Whatever a Worker
> writes to its database instance is visible only to that Worker.
>
> So, basically, the only way to get data out of a Worker is to do an
> ask/answer.
>
> I've updated the harness to demonstrate putting data in and getting data
> out.
>
> Do an mvn clean install, then cd into examples/stambecco-example-skittr and
> type "mvn jetty:run"  In a separate window, cd into harness and then type
> "sbt"  From the sbt command line, type "run user1" then "run user2"  Add a
> message to user1, type "run -m 1" which will add a message to the timeline
> of user1.  Next, in your browser, browse tohttp://localhost:8080/timeline/1You'll
> see the timeline for user1.
>
> Please give it a try and see if it works for you.
>
> Thanks,
>
> David
>
>
>
>
>
> > The following is the code I use to get the UserWorker:
>
> >  val userWorker = WorkerMgr find UserId(currentUserDetails.userId)
> > openOr null
> >  userWorker ! PostUpdate(id, msg, "web", new Date())
>
> > Pretty much from here it is similiar to the skittr example code calls,
> > doUpdate, then doAddUpdate
>
> > Any help is appreciated.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Goat Rodeo" group.
> > To post to this group, send email to goat-...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > goat-rodeo+...@googlegroups.com<goat-rodeo%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/goat-rodeo?hl=en.
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Surf the harmonics
>
> --
> You received this message because you are subscribed to the Google Groups "Goat Rodeo" group.
> To post to this group, send email to goat-...@googlegroups.com.
> To unsubscribe from this group, send email to goat-rodeo+...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/goat-rodeo?hl=en.

Jay

unread,
May 4, 2010, 10:43:48 AM5/4/10
to Goat Rodeo
When I do a query from the db it is outside the worker, but I thought
that if you persist it on the backend. Any one could have access to
it. Although in the example is the backend storage RDBMS? That's
what I am trying to use.

I followed the direction that were given above and I received this
error.

/home/cainj/goat_rodeo/harness/src/main/scala/org/stambecco/harness/
Run.scala:4: not found: value net
[error] import net.liftweb._
[error] ^
[error] one error found
[info] == compile ==
[error] Error running compile: Compilation failed
[info]
[info] Total time: 10 s, completed May 4, 2010 8:38:42 AM

On May 3, 10:24 pm, David Pollak <feeder.of.the.be...@gmail.com>
wrote:
> On Mon, May 3, 2010 at 12:00 PM, Jay <cain....@gmail.com> wrote:
> > I'm having issues committing data into the database using Stambecco.
> > I'm using the Skittr code as an example.  When I'm debugging I get the
> > following message:
>
> > " 2010-05-03 11:41:07,235 [pool-2-thread-7] DEBUG
> > net.liftweb.mapper.MetaMapper - Saving dbName=Message,
>
> > entity=com.echo.model.Message=postedBy=1,SourceUrl=,Latitude=,Longitude=,messageId=0,id=-1,Source=web,Body=loop,Created=Mon,
> > 3 May 2010 17:41:07 UTC} "
>
> > but when I query the database that row does not exists.
>
> When you say "I query the database", do you mean from within the Worker or
> from outside the Worker?
>
> Each Worker has its own separate database instance.  Whatever a Worker
> writes to its database instance is visible only to that Worker.
>
> So, basically, the only way to get data out of a Worker is to do an
> ask/answer.
>
> I've updated the harness to demonstrate putting data in and getting data
> out.
>
> Do an mvn clean install, then cd into examples/stambecco-example-skittr and
> type "mvn jetty:run"  In a separate window, cd into harness and then type
> "sbt"  From the sbt command line, type "run user1" then "run user2"  Add a
> message to user1, type "run -m 1" which will add a message to the timeline
> of user1.  Next, in your browser, browse tohttp://localhost:8080/timeline/1You'll
> see the timeline for user1.
>
> Please give it a try and see if it works for you.
>
> Thanks,
>
> David
>
>
>
>
>
> > The following is the code I use to get the UserWorker:
>
> >  val userWorker = WorkerMgr find UserId(currentUserDetails.userId)
> > openOr null
> >  userWorker ! PostUpdate(id, msg, "web", new Date())
>
> > Pretty much from here it is similiar to the skittr example code calls,
> > doUpdate, then doAddUpdate
>
> > Any help is appreciated.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Goat Rodeo" group.
> > To post to this group, send email to goat-...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > goat-rodeo+...@googlegroups.com<goat-rodeo%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/goat-rodeo?hl=en.
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Surf the harmonics
>
> --
> You received this message because you are subscribed to the Google Groups "Goat Rodeo" group.
> To post to this group, send email to goat-...@googlegroups.com.
> To unsubscribe from this group, send email to goat-rodeo+...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/goat-rodeo?hl=en.

Jay

unread,
May 4, 2010, 1:22:49 PM5/4/10
to Goat Rodeo
After further researching and reading (it always helps when you
actually read the entire tutorial), I understand the framework. It is
actually being stored to disk. That's my bad. I saw in the Twitter-
clone wiki and understood that each Worker has its own personal
database store. Question though, I started developing using the
mapper MegaProtoUser will this still work seamlessly with the Workers
writing all of its information to its own personal database. Are
there any drawbacks?

Thanks for the help Dave.

Stambecco is pretty slick.

Jay

David Pollak

unread,
May 4, 2010, 2:32:40 PM5/4/10
to goat-...@googlegroups.com
On Tue, May 4, 2010 at 10:22 AM, Jay <cain...@gmail.com> wrote:
After further researching and reading (it always helps when you
actually read the entire tutorial), I understand the framework.  It is
actually being stored to disk.  That's my bad.  I saw in the Twitter-
clone wiki and understood that each Worker has its own personal
database store.   Question though, I started developing using the
mapper MegaProtoUser will this still work seamlessly with the Workers
writing all of its information to its own personal database.  Are
there any drawbacks?

Well... you can do both... store to the local data store or a shared RDBMS.

The advantage of the Worker-local data store is that you've got built-in sharding.  Also, the Worker-local data is stored in files in single-node configurations, but are stored in Cassandra in multi-node configurations.

The disadvantages of Worker-local data are: non-trival start-up time for each worker and the inability to access the data except as messages to the Worker.

You can also use a shared RDBMS (although this is not currently integrated with Stambecco's transaction mechanism and having many workers that share a single SQL transaction is not possible).  Lift's Mapper is built on the concept of connection identifiers.  You can register a JDBC connection vendor for a given connection identifier.  Once the association is made, use the Mapper alternatives that take an explicit connection identifier for operations on the central RDBMS and use the default connection identifier for Worker-specific persistence.

Thanks,

David
 



--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Reply all
Reply to author
Forward
0 new messages