小编use*_*554的帖子

与redis和socket io的laravel回声

我有一个事件SomeEvent.php

像这样:

<?php

namespace App\Events;

use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class SomeEvent  implements ShouldBroadcast
{


    use InteractsWithSockets, SerializesModels;

   public $data;
    /**
     * Create a new event instance.
     *
     * @return void
     */
    public function __construct($array)
    {
        $this->data = $array;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return Channel|array
     */
    public function broadcastOn()
    {
        return new PrivateChannel('channel-name');
    }
}
Run Code Online (Sandbox Code Playgroud)

我已经在我的bootstrap.js中包含以下内容并使用gulp进行编译

import Echo from "laravel-echo"

window.Echo = new Echo({ …
Run Code Online (Sandbox Code Playgroud)

php sockets node.js laravel-5

7
推荐指数
1
解决办法
2347
查看次数

传递动态文件名以从发布请求进行处理

上传到spring批处理后传递动态文件名进行处理

我是 Spring Batch 的新手,我想要完成的是从一个应用程序上传一个 csv 文件,然后使用上传文件的文件名向 Spring Batch 发送一个 post 请求,并让 Spring Batch 从它所在的位置获取文件并处理它。

我试图将字符串值传递给阅读器,但我不知道如何在步骤中访问它

// controller where i want to pass the file name to the reader
@RestController

public class ProcessController {

    @Autowired
    JobLauncher jobLauncher;

    @Autowired
    Job importUserJob;

    @PostMapping("/load")
    public BatchStatus Load(@RequestParam("filePath") String filePath) throws JobParametersInvalidException, JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException {

        JobExecution jobExecution = jobLauncher.run(importUserJob, new JobParametersBuilder()
                .addString("fullPathFileName", filePath)
                .toJobParameters());

        return jobExecution.getStatus();

    }
}

//reader in my configuration class
 @Bean
    public FlatFileItemReader<Person> reader(@Value("#{jobParameters[fullPathFileName]}") String pathToFile) 


// the problem is …
Run Code Online (Sandbox Code Playgroud)

java spring spring-batch

4
推荐指数
1
解决办法
1471
查看次数

在 flutter 中使用 bloc 模式时的建议

使用 flutter bloc 时有什么建议,是否建议每个页面都有自己的 bloc,或者我可以为多个页面重用一个块,如果可以,如何?

flutter bloc

2
推荐指数
1
解决办法
2081
查看次数

标签 统计

bloc ×1

flutter ×1

java ×1

laravel-5 ×1

node.js ×1

php ×1

sockets ×1

spring ×1

spring-batch ×1