我有一个事件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) 上传到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) 使用 flutter bloc 时有什么建议,是否建议每个页面都有自己的 bloc,或者我可以为多个页面重用一个块,如果可以,如何?