Skip to content

Instantly share code, notes, and snippets.

public class CustomerService
{
// Commands
void MakeCustomerPreferred(CustomerId)
void ChangeCustomerLocale(CustomerId, NewLocale)
void CreateCustomer(Customer)
void EditCustomerDetails(CustomerDetails)
// Queries
Customer GetCustomer(CustomerId)
public class CustomerWriteService
{
// Commands
void MakeCustomerPreferred(CustomerId)
void ChangeCustomerLocale(CustomerId, NewLocale)
void CreateCustomer(Customer)
void EditCustomerDetails(CustomerDetails)
}
public class CustomerReadService
@kellabyte
kellabyte / link.cs
Created March 18, 2012 20:35
LinkTest
using System.Collections.Generic;
using System.Xml.Serialization;
using Services;
namespace UserProfileService.Models
{
[XmlRoot("user")]
public class User : IEntity<int>
{
[XmlElement("id")]
/*
<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:as="http://atomserver.org/namespaces/1.0/"
xmlns:os="http://a9.com/-/spec/opensearchrss/1.1/">
<os:totalResults>65801</os:totalResults>
<os:startIndex>0</os:startIndex>
<os:itemsPerPage>2</os:itemsPerPage>
<as:endIndex>153</as:endIndex>
<link href="/myserver/v1/widgets/acme?start-index=153&amp;max-results=2" rel="next" />
@kellabyte
kellabyte / output.log
Created May 4, 2012 01:36
CQL Cassandra Exception
ERROR 21:33:16,277 Fatal exception in thread Thread[ReadStage:3375,5,main]
java.lang.RuntimeException: java.lang.RuntimeException: Solr search queries only supported on the 'solr_query' field
at org.apache.cassandra.service.IndexScanVerbHandler.doVerb(IndexScanVerbHandler.java:51)
at org.apache.cassandra.net.MessageDeliveryTask.run(MessageDeliveryTask.java:59)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.RuntimeException: Solr search queries only supported on the 'solr_query' field
at com.datastax.bdp.cassandra.index.solr.SolrSecondaryIndexSearcher.extractExpression(SolrSecondaryIndexSearcher.java:77)
at com.datastax.bdp.cassandra.index.solr.SolrSecondaryIndexSearcher.search(SolrSecondaryIndexSearcher.java:88)
@kellabyte
kellabyte / github.cs
Created May 13, 2012 20:59
Sample events from GitHub archives
//
// Example JSON from GitHub archives
//
//{"public":true,"actor_attributes":{"gravatar_id":"a65909227f4385974f7af051e4ac3e8d","email":"moloch@hushmail.me","login":"moloch--","blog":"http://rootthebox.com","name":"Moloch","company":"[Buffer]Overflow","location":"Earth","type":"User"},"repository":{"description":"Game of Hackers","has_wiki":true,"owner":"moloch--","open_issues":0,"homepage":"http://rootthebox.com","watchers":1,"pushed_at":"2012/03/10 22:36:55 -0800","created_at":"2012/03/10 22:30:48 -0800","fork":false,"size":0,"has_downloads":true,"name":"RootTheBox","has_issues":true,"url":"https://github.com/moloch--/RootTheBox","forks":1,"private":false},"created_at":"2012/03/10 22:36:55 -0800","payload":{"master_branch":"master","ref_type":"branch","ref":"master","description":"Game of Hackers"},"actor":"moloch--","url":"https://github.com/moloch--/RootTheBox/compare/master","type":"CreateEvent"}{"public":true,"actor_attributes":{"gravatar_id":"8d72d59c1604f7ea3b916f5e775c8724","login":"akolosov","name"
public interface IScheduledTask
{
[DataMember]
Guid TaskId { get; set; }
}
// This is a generic implementation of IScheduledTask.
[DataContract]
public class ScheduledTask<T> : IScheduledTask
{
[DataContract]
public class OrderTask
{
public OrderTask(int taskPriority)
{
this.TaskPriority = taskPriority;
}
[DataMember]
public int TaskPriority { get; set; }
class Program
{
static void Main(string[] args)
{
ScheduledTaskService service = new ScheduledTaskService();
ServiceHost host = new ServiceHost(service);
host.Open();
IScheduledTaskService client = CreateClient("net.tcp://localhost:1212");
ScheduledTask<OrderTask> task = new ScheduledTask<OrderTask>();