public static void SendRedisDoWork(object sender, DoWorkEventArgs e)
{
string hostName = System.Environment.MachineName + "." +
Microsoft.Win32.Registry.LocalMachine.OpenSubKey(
"SYSTEM\\CurrentControlSet\\services\\Tcpip\\Parameters").GetValue("Domain", "").ToString();
RedisClient rc = new RedisClient(parms.Host, parms.Port);
for (int i = 0; i < parms.NumMessages; i++)
{
JObject o = new JObject
{
{"Application", "redis-generator"},
{"Host", hostName},
{"UtcTimestamp", DateTime.UtcNow.ToString("o")},
{"Type", "redis"},
{"Message", "redis message " + DateTime.UtcNow.ToString("o")},
{"Index", "logstash"}
};
byte[] bytes = System.Text.Encoding.UTF8.GetBytes(o.ToString());
int restult = rc.RPush("QCS", bytes);
}
}
'c# 언어' 카테고리의 다른 글
WinForms & WPF(Windows Presentation Foundation) 비교 (0) | 2022.02.22 |
---|---|
C# - 마샬링이란(Marshalling) (0) | 2022.01.13 |
string[] split = str.Split('.'); (0) | 2022.01.04 |
Console.WriteLine(">" + string.Format("{0:D10}", Convert.ToInt64(str))); (0) | 2022.01.03 |
this.Text = "베트남어: Ti?ng Thai"; (0) | 2021.12.25 |