我在使用kafka-net插件的Red Hat VM上使用kafka 0.8.1.1.如何配置我的消费者停止接收来自kafka的早期消息?
我的消费者代码:
var options = new KafkaOptions(new Uri("tcp://199.53.249.150:9092"), new Uri("tcp://199.53.249.151:9092"));
Stopwatch sp = new Stopwatch();
var router = new BrokerRouter(options);
var consumer = new Consumer(new ConsumerOptions("Test", router));
ThreadStart start2 = () =>
{
while (true)
{
sp.Start();
foreach (var message in consumer.Consume())
{
if (MessageDecoderReceiver.MessageBase(message.Value) != null)
{
PrintMessage(MessageDecoderReceiver.MessageBase(message.Value).ToString());
}
else
{
Console.WriteLine(message.Value);
}
}
sp.Stop();
}
};
var thread2 = new Thread(start2);
thread2.Start();
Run Code Online (Sandbox Code Playgroud) 我的项目已经使用Android Volley网络框架很长一段时间了,但最近我发现了Internet上发布的SSL 3.0协议错误.
我想知道如何找出我的项目使用的TLS版本,以及如何确认库是否更新.
这是我的源代码片段:
HttpStack stack = new HurlStack();
Network network = new BasicNetwork(stack);
mHttpRequestQueue = new RequestQueue(new NoCache(), network);
mHttpRequestQueue.start();
Run Code Online (Sandbox Code Playgroud)
我认为重点在于HurlStack类,它取决于org.apache.http包,但我无法弄清楚TLS/SSL配置的位置.
我正在构建一个具有多个纸质页面的iPad应用程序,我想实现一种页面过渡效果,类似于您在iPad上的iBooks应用程序中翻页时看到的动画.几个问题...
我一直在寻找使用Hortonworks 2.1安装的Storm,但为了避免在Cloudera安装(其中包含Spark)之外安装Hortonworks,我试图找到一种在Cloudera中使用Storm的方法.
如果可以在单个平台上同时使用Storm和Spark,那么它将节省在计算机上安装Cloudera和Hortonworks所需的额外资源.
我正在尝试为Office 365构建一个多租户应用程序,该应用程序专注于SharePoint Online并使用OAuth2通过Azure进行身份验证.此问题特定于通过Azure登录进行SharePoint访问,但仅在使用此API使用OAuth2进行身份验证时才会发现.
正确注册应用程序并在Azure和Office中设置用户的许多机制虽然有些复杂,但却能够充分利用时间投资.
即使Azure的基本OAuth2协议使用也相对顺利.但是,凭借SharePoint的"资源"参数,我无法使我的应用程序成为真正的多租户.这显然要求我的应用程序在完成登录序列之前知道最终用户的根SharePoint站点URL.我看不出这是怎么可能的.有人请指出我正确的方向.
以下是实际登录顺序的示例:
GET /common/oauth2/authorize?client_id=5cb5e93b-57f5-4e09-97c5-e0d20661c59a
&redirect_uri=https://myappdomain.com/v1/oauth2_redirect/
&response_type=code&prompt=login&state=D79E5777 HTTP/1.1
Host: login.windows.net
Cache-Control: no-cache
Run Code Online (Sandbox Code Playgroud)
当用户进行身份验证时,这会导致调用重定向,如下所示:
https://myappdomain.com/v1/oauth2_redirect/?code=AAABAAAAvPM1KaPlrEq...{blah*3}
Run Code Online (Sandbox Code Playgroud)
到目前为止很棒!3-legged身份验证的下一步是POST返回/ token端点,以获取要在所有后续REST调用中使用的实际Bearer令牌.这只是经典的OAuth2 ......
POST /common/oauth2/token HTTP/1.1
Host: login.windows.net
Accept: text/json
Cache-Control: no-cache
----WebKitFormBoundaryE19zNvXGzXaLvS5C
Content-Disposition: form-data; name="grant_type"
authorization_code
----WebKitFormBoundaryE19zNvXGzXaLvS5C
Content-Disposition: form-data; name="code"
AAABAAAAvPM1KaPlrEq...{blah*3}
----WebKitFormBoundaryE19zNvXGzXaLvS5C
Content-Disposition: form-data; name="client_id"
5cb5e93b-57f5-4e09-97c5-e0d20661c59a
----WebKitFormBoundaryE19zNvXGzXaLvS5C
Content-Disposition: form-data; name="client_secret"
02{my little secret}I=
----WebKitFormBoundaryE19zNvXGzXaLvS5C
Content-Disposition: form-data; name="redirect_uri"
https://myappdomain.com/v1/oauth2_redirect/
----WebKitFormBoundaryE19zNvXGzXaLvS5C
Content-Disposition: form-data; name="resource"
https://contoso.sharepoint.com/
----WebKitFormBoundaryE19zNvXGzXaLvS5C
Run Code Online (Sandbox Code Playgroud)
而且这里变得粘稠."resource"参数是必需的,并且必须指向您要访问的特定于用户的端点.对于Exchange或Azure,端点始终相同.(https://graph.windows.net或https://outlook.office365.com)但SharePoint对每个租赁都有不同的端点.您尚未实际登录该用户,但您已经需要有关您尚未拥有的用户的信息.
如果我部署的应用程序版本假设"contoso"作为租户名称(如上所述),那么只有contoso租户中的用户才能成功使用我的应用程序读取SharePoint数据.一旦fabrikam中的另一个用户尝试使用它,我POST到/token端点就会要求获得错误站点的许可......而且还有问题.
我怎样才能检测到正确的端点POST到/token先于实际登录用户端点?是否有一些我可以使用的隐藏信息给我?是否有某种发现可以检测租户的根SharePoint URL?或者更好的是,是否有一个端点,我可以作为可以代表租户家的资源(类似的东西 …
我正在尝试使用LINQ表达式树来初始化一个新的匿名对象,该对象具有来自传入对象的字段子集.字段子集通常是单个属性,但可能更多(大约4个).
一个例子:
void DoWork(Type t)
{
//do some work to figure out which properties I want to use
List<PropertyInfo>() props = (from p in t.GetProperties()
where p.HasAttribute(MyAttribute)
select p).ToList();
//now I want to create a lambda expression that's like:
// (x=> new {x.Prop1, x.Prop2, ...})
//for each property in the list props
//create parameter
var param = Expression.Parameter(t,"t");
//get list of expressions for properties
var initValues = (from p in props
select Expression.PropertyOrField(param, p.Name)
).ToList();
//build expression body
Expression body …Run Code Online (Sandbox Code Playgroud) 我的问题非常类似于http://camel.465427.n5.nabble.com/FTP-ConsumerTemplate-Threads-remaining-alive-td5548338.html.
你如何杀死不同端点上的Camel锁定线程?我尝试删除端点并在设置doneUoW后停止ConsumerTemplate,但这些都不起作用.
我有一个使用Office 365 SharePoint预览API的客户端应用程序.最近(截至2014年10月),Microsoft发布了该API的1.0版本.预览API使用的身份验证步骤不再适用于1.0版.
为了演示这个问题,我创建了一个简短的node.js脚本.该脚本执行以下操作:
POST以https://login.windows.net/common/oauth2/token获得一个访问令牌GET 到Office 365发现服务以获取SharePoint API端点POST到https://login.windows.net/common/oauth2/token了刷新令牌获取新的访问令牌GET 到SharePoint API端点以获取文件列表该脚本可以与API的预览API和版本1.0一起使用.它能够从预览API获取文件的JSON列表,但是对于版本1.0(在最后一次调用中)以及以下内容失败:
{
"error": {
"code": "-2147024891, System.UnauthorizedAccessException",
"message": "Access denied. You do not have permission to perform this action or access this resource."
}
}
Run Code Online (Sandbox Code Playgroud)
有没有人看到调用顺序有什么问题?
请查看示例脚本以获取更多详细信息.
在昨天的更新之后,它将不会使用这两个PNG图像构建或运行项目作为背景图像.一旦我删除这些图像一切正常(我将图像放在drawable文件夹中).
:app:mergeDebugResources FAILED
C:\Users\Daedlues\Desktop\Android-Studio-Projects\AndroidInterView\app\src\main\res\drawable\middle.png
Error:Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Daedlues\Desktop\Work\SDK\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 42
Error:Execution failed for task ':app:mergeDebugResources'.
> C:\Users\Daedlues\Desktop\Android-Studio-Projects\AndroidInterView\app\src\main\res\drawable\middle.png: Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Daedlues\Desktop\Work\SDK\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 42
Information:BUILD FAILED
Run Code Online (Sandbox Code Playgroud) android ×2
c# ×2
office365 ×2
sharepoint ×2
angularjs ×1
apache-camel ×1
apache-kafka ×1
apache-storm ×1
azure ×1
cloudera ×1
consumer ×1
file ×1
https ×1
ios ×1
iphone ×1
lambda ×1
linq ×1
multi-tenant ×1
oauth-2.0 ×1
ssl ×1
uikit ×1